Class BeanstalkEndpoint

  • All Implemented Interfaces:
    AutoCloseable, org.apache.camel.AsyncEndpoint, org.apache.camel.CamelContextAware, org.apache.camel.Endpoint, org.apache.camel.IsSingleton, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.HasId, org.apache.camel.StatefulService, org.apache.camel.SuspendableService

    @UriEndpoint(firstVersion="2.15.0",
                 scheme="beanstalk",
                 title="Beanstalk",
                 syntax="beanstalk:connectionSettings",
                 category=MESSAGING)
    public class BeanstalkEndpoint
    extends org.apache.camel.support.ScheduledPollEndpoint
    implements org.apache.camel.AsyncEndpoint
    Retrieve and post-process Beanstalk jobs.
    • Field Summary

      • Fields inherited from class org.apache.camel.support.service.BaseService

        BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.camel.Consumer createConsumer​(org.apache.camel.Processor processor)  
      org.apache.camel.Producer createProducer()
      Creates Camel producer.
      BeanstalkCommand getCommand()  
      ConnectionSettings getConn()  
      ConnectionSettings getConnection()  
      String getConnectionSettings()  
      int getJobDelay()  
      long getJobPriority()  
      int getJobTimeToRun()  
      BeanstalkCommand getOnFailure()  
      boolean isAwaitJob()  
      boolean isUseBlockIO()  
      void setAwaitJob​(boolean awaitJob)
      Whether to wait for job to complete before ack the job from beanstalk
      void setCommand​(BeanstalkCommand command)
      put means to put the job into Beanstalk.
      void setJobDelay​(int jobDelay)
      Job delay in seconds.
      void setJobPriority​(long jobPriority)
      Job priority.
      void setJobTimeToRun​(int jobTimeToRun)
      Job time to run in seconds.
      void setOnFailure​(BeanstalkCommand onFailure)
      Command to use when processing failed.
      void setUseBlockIO​(boolean useBlockIO)
      Whether to use blockIO.
      • Methods inherited from class org.apache.camel.support.ScheduledPollEndpoint

        configureConsumer, configureProperties, configureScheduledPollConsumerProperties, doConfigureConsumer, doStart, doStop, getBackoffErrorThreshold, getBackoffIdleThreshold, getBackoffMultiplier, getDefaultDelay, getDelay, getInitialDelay, getPollStrategy, getRepeatCount, getRunLoggingLevel, getScheduledExecutorService, getScheduler, getSchedulerProperties, getTimeUnit, isGreedy, isSendEmptyMessageWhenIdle, isStartScheduler, isUseFixedDelay, setBackoffErrorThreshold, setBackoffIdleThreshold, setBackoffMultiplier, setDelay, setGreedy, setInitialDelay, setPollStrategy, setRepeatCount, setRunLoggingLevel, setScheduledExecutorService, setScheduler, setSchedulerProperties, setSendEmptyMessageWhenIdle, setStartScheduler, setTimeUnit, setUseFixedDelay
      • Methods inherited from class org.apache.camel.support.DefaultEndpoint

        configurePollingConsumer, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, doInit, equals, getCamelContext, getComponent, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, isLenientProperties, isPollingConsumerBlockWhenFull, isSingleton, isSynchronous, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setComponent, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setLazyStartProducer, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerQueueSize, setProperties, setSynchronous, toString
      • Methods inherited from class org.apache.camel.support.service.BaseService

        build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
      • Methods inherited from interface org.apache.camel.Endpoint

        configureProperties, createAsyncProducer, createExchange, createExchange, createPollingConsumer, getCamelContext, getEndpointBaseUri, getEndpointKey, getEndpointUri, isLenientProperties, isSingletonProducer, setCamelContext
      • Methods inherited from interface org.apache.camel.IsSingleton

        isSingleton
      • Methods inherited from interface org.apache.camel.Service

        build, close, init, start, stop
      • Methods inherited from interface org.apache.camel.ShutdownableService

        shutdown
      • Methods inherited from interface org.apache.camel.StatefulService

        getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
      • Methods inherited from interface org.apache.camel.SuspendableService

        isSuspended, resume, suspend
    • Constructor Detail

      • BeanstalkEndpoint

        public BeanstalkEndpoint​(String uri,
                                 org.apache.camel.Component component,
                                 ConnectionSettings conn,
                                 String connectionSettings)
    • Method Detail

      • getConnectionSettings

        public String getConnectionSettings()
      • setCommand

        public void setCommand​(BeanstalkCommand command)
        put means to put the job into Beanstalk. Job body is specified in the Camel message body. Job ID will be returned in beanstalk.jobId message header. delete, release, touch or bury expect Job ID in the message header beanstalk.jobId. Result of the operation is returned in beanstalk.result message header kick expects the number of jobs to kick in the message body and returns the number of jobs actually kicked out in the message header beanstalk.result.
      • getJobPriority

        public long getJobPriority()
      • setJobPriority

        public void setJobPriority​(long jobPriority)
        Job priority. (0 is the highest, see Beanstalk protocol)
      • getJobDelay

        public int getJobDelay()
      • setJobDelay

        public void setJobDelay​(int jobDelay)
        Job delay in seconds.
      • getJobTimeToRun

        public int getJobTimeToRun()
      • setJobTimeToRun

        public void setJobTimeToRun​(int jobTimeToRun)
        Job time to run in seconds. (when 0, the beanstalkd daemon raises it to 1 automatically, see Beanstalk protocol)
      • setOnFailure

        public void setOnFailure​(BeanstalkCommand onFailure)
        Command to use when processing failed.
      • isUseBlockIO

        public boolean isUseBlockIO()
      • setUseBlockIO

        public void setUseBlockIO​(boolean useBlockIO)
        Whether to use blockIO.
      • isAwaitJob

        public boolean isAwaitJob()
      • setAwaitJob

        public void setAwaitJob​(boolean awaitJob)
        Whether to wait for job to complete before ack the job from beanstalk
      • createProducer

        public org.apache.camel.Producer createProducer()
                                                 throws Exception
        Creates Camel producer.

        Depending on the command parameter (see BeanstalkComponent URI) it will create one of the producer implementations.

        Specified by:
        createProducer in interface org.apache.camel.Endpoint
        Returns:
        Producer instance
        Throws:
        IllegalArgumentException - when ConnectionSettings cannot create a writable Client
        Exception
      • createConsumer

        public org.apache.camel.Consumer createConsumer​(org.apache.camel.Processor processor)
                                                 throws Exception
        Specified by:
        createConsumer in interface org.apache.camel.Endpoint
        Throws:
        Exception