/** * Creates new message splitter. * * @param messageService the message service * @param camelCtx the Camel context * @param splitterCallback the callback for getting split messages */ public MessageSplitterImpl(MessageService messageService, ModelCamelContext camelCtx, MessageSplitterCallback splitterCallback) { Assert.notNull(messageService, "the messageService must not be null"); Assert.notNull(camelCtx, "the camelCtx must not be null"); Assert.notNull(splitterCallback, "the splitterCallback must not be null"); this.camelCtx = camelCtx; this.messageService = messageService; this.splitterCallback = splitterCallback; this.executor = camelCtx.getExecutorServiceManager().newThreadPool(this, "MessageSplitter", 1, 3); }
public CamelCloudClient(CamelCloudService cloudService, CamelContext camelContext, String applicationId, String baseEndpoint) { this.cloudService = cloudService; this.camelContext = camelContext; this.producerTemplate = camelContext.createProducerTemplate(); this.applicationId = applicationId; this.baseEndpoint = baseEndpoint; this.executorService = camelContext.getExecutorServiceManager().newThreadPool(this, "CamelCloudClient/" + applicationId, 0, 1); }
private void init() { if (this.workerPool == null) { this.workerPool = context.getExecutorServiceManager().newThreadPool( this, configuration.getThreadPoolName(), configuration.getThreadPoolMinSize(), configuration.getThreadPoolMaxSize() ); } }
public ExecutorService createProducerExecutor() { int core = getConfiguration().getWorkerPoolCoreSize(); int max = getConfiguration().getWorkerPoolMaxSize(); return getCamelContext().getExecutorServiceManager().newThreadPool(this, "KafkaProducer[" + configuration.getTopic() + "]", core, max); }
protected ReplyManager createReplyManager(String replyTo) throws Exception { // use a regular queue ReplyManager replyManager = new QueueReplyManager(getEndpoint().getCamelContext()); replyManager.setEndpoint(getEndpoint()); String name = "JmsReplyManagerTimeoutChecker[" + replyTo + "]"; ScheduledExecutorService replyManagerScheduledExecutorService = getEndpoint().getCamelContext().getExecutorServiceManager().newSingleThreadScheduledExecutor(name, name); replyManager.setScheduledExecutorService(replyManagerScheduledExecutorService); name = "JmsReplyManagerOnTimeout[" + replyTo + "]"; // allow the timeout thread to timeout so during normal operation we do not have a idle thread int max = getEndpoint().getReplyToOnTimeoutMaxConcurrentConsumers(); if (max <= 0) { throw new IllegalArgumentException("The option replyToOnTimeoutMaxConcurrentConsumers must be >= 1"); } ExecutorService replyManagerExecutorService = getEndpoint().getCamelContext().getExecutorServiceManager().newThreadPool(replyManager, name, 0, max); replyManager.setOnTimeoutExecutorService(replyManagerExecutorService); ServiceHelper.startService(replyManager); return replyManager; }
protected ReplyManager createReplyManager() throws Exception { // use a temporary queue ReplyManager replyManager = new TemporaryQueueReplyManager(getEndpoint().getCamelContext()); replyManager.setEndpoint(getEndpoint()); String name = "JmsReplyManagerTimeoutChecker[" + getEndpoint().getEndpointConfiguredDestinationName() + "]"; ScheduledExecutorService replyManagerScheduledExecutorService = getEndpoint().getCamelContext().getExecutorServiceManager().newSingleThreadScheduledExecutor(name, name); replyManager.setScheduledExecutorService(replyManagerScheduledExecutorService); name = "JmsReplyManagerOnTimeout[" + getEndpoint().getEndpointConfiguredDestinationName() + "]"; // allow the timeout thread to timeout so during normal operation we do not have a idle thread int max = getEndpoint().getReplyToOnTimeoutMaxConcurrentConsumers(); if (max <= 0) { throw new IllegalArgumentException("The option replyToOnTimeoutMaxConcurrentConsumers must be >= 1"); } ExecutorService replyManagerExecutorService = getEndpoint().getCamelContext().getExecutorServiceManager().newThreadPool(replyManager, name, 0, max); replyManager.setOnTimeoutExecutorService(replyManagerExecutorService); ServiceHelper.startService(replyManager); return replyManager; }
args.executorService(getEndpoint().getCamelContext().getExecutorServiceManager().newThreadPool(this, getEndpoint().getEndpointUri(), configuration.getPoolSize(), configuration.getMaxPoolSize())); args.startThreadPool(getEndpoint().getCamelContext().getExecutorServiceManager().newSingleThreadExecutor(this, "start-" + getEndpoint().getEndpointUri())); args.processor((TProcessor)serverProcessor); args.transportFactory(new TZlibTransport.Factory()); args.executorService(getEndpoint().getCamelContext().getExecutorServiceManager().newThreadPool(this, getEndpoint().getEndpointUri(), configuration.getPoolSize(), configuration.getMaxPoolSize())); args.startThreadPool(getEndpoint().getCamelContext().getExecutorServiceManager().newSingleThreadExecutor(this, "start-" + getEndpoint().getEndpointUri())); args.executorService(getEndpoint().getCamelContext().getExecutorServiceManager().newThreadPool(this, getEndpoint().getEndpointUri(), configuration.getPoolSize(), configuration.getMaxPoolSize())); args.startThreadPool(getEndpoint().getCamelContext().getExecutorServiceManager().newSingleThreadExecutor(this, "start-" + getEndpoint().getEndpointUri()));