Class SjmsEndpoint

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

    @UriEndpoint(firstVersion="2.11.0",
                 scheme="sjms",
                 title="Simple JMS",
                 syntax="sjms:destinationType:destinationName",
                 category=MESSAGING)
    public class SjmsEndpoint
    extends org.apache.camel.support.DefaultEndpoint
    implements org.apache.camel.AsyncEndpoint, org.apache.camel.MultipleConsumersSupport, org.apache.camel.spi.HeaderFilterStrategyAware
    Send and receive messages to/from a JMS Queue or Topic using plain JMS 1.x API. This component uses plain JMS API where as the jms component uses Spring JMS.
    • Field Detail

      • logger

        protected final org.slf4j.Logger logger
    • Constructor Detail

      • SjmsEndpoint

        public SjmsEndpoint()
      • SjmsEndpoint

        public SjmsEndpoint​(String uri,
                            org.apache.camel.Component component,
                            String remaining)
    • Method Detail

      • getComponent

        public SjmsComponent getComponent()
        Overrides:
        getComponent in class org.apache.camel.support.DefaultEndpoint
      • doStart

        protected void doStart()
                        throws Exception
        Overrides:
        doStart in class org.apache.camel.support.DefaultEndpoint
        Throws:
        Exception
      • doStop

        protected void doStop()
                       throws Exception
        Overrides:
        doStop in class org.apache.camel.support.DefaultEndpoint
        Throws:
        Exception
      • createProducer

        public org.apache.camel.Producer createProducer()
                                                 throws Exception
        Specified by:
        createProducer in interface org.apache.camel.Endpoint
        Throws:
        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
      • isMultipleConsumersSupported

        public boolean isMultipleConsumersSupported()
        Specified by:
        isMultipleConsumersSupported in interface org.apache.camel.MultipleConsumersSupport
      • createExchange

        public org.apache.camel.Exchange createExchange​(javax.jms.Message message,
                                                        javax.jms.Session session)
      • setBinding

        public void setBinding​(JmsBinding binding)
        Sets the binding used to convert from a Camel message to and from a JMS message
      • setDestinationName

        public void setDestinationName​(String destinationName)
        DestinationName is a JMS queue or topic name. By default, the destinationName is interpreted as a queue name.
      • getDestinationName

        public String getDestinationName()
      • getHeaderFilterStrategy

        public org.apache.camel.spi.HeaderFilterStrategy getHeaderFilterStrategy()
        Specified by:
        getHeaderFilterStrategy in interface org.apache.camel.spi.HeaderFilterStrategyAware
      • setHeaderFilterStrategy

        public void setHeaderFilterStrategy​(org.apache.camel.spi.HeaderFilterStrategy strategy)
        To use a custom HeaderFilterStrategy to filter header to and from Camel message.
        Specified by:
        setHeaderFilterStrategy in interface org.apache.camel.spi.HeaderFilterStrategyAware
      • isIncludeAllJMSXProperties

        public boolean isIncludeAllJMSXProperties()
      • setIncludeAllJMSXProperties

        public void setIncludeAllJMSXProperties​(boolean includeAllJMSXProperties)
        Whether to include all JMSXxxx properties when mapping from JMS to Camel Message. Setting this to true will include properties such as JMSXAppID, and JMSXUserID etc. Note: If you are using a custom headerFilterStrategy then this option does not apply.
      • setConnectionResource

        public void setConnectionResource​(ConnectionResource connectionResource)
        Initializes the connectionResource for the endpoint, which takes precedence over the component's connectionResource, if any
      • setConnectionResource

        public void setConnectionResource​(String connectionResource)
      • isSynchronous

        public boolean isSynchronous()
        Overrides:
        isSynchronous in class org.apache.camel.support.DefaultEndpoint
      • setSynchronous

        public void setSynchronous​(boolean synchronous)
        Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
        Overrides:
        setSynchronous in class org.apache.camel.support.DefaultEndpoint
      • setAcknowledgementMode

        public void setAcknowledgementMode​(SessionAcknowledgementType acknowledgementMode)
        The JMS acknowledgement name, which is one of: SESSION_TRANSACTED, CLIENT_ACKNOWLEDGE, AUTO_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE
      • isTopic

        public boolean isTopic()
        Flag set by the endpoint used by consumers and producers to determine if the endpoint is a JMS Topic.
      • getSessionCount

        @Deprecated
        public int getSessionCount()
        Deprecated.
        Returns the number of Session instances expected on this endpoint.
      • setSessionCount

        @Deprecated
        public void setSessionCount​(int sessionCount)
        Deprecated.
        Sets the number of Session instances used for this endpoint. Value is ignored for endpoints that require a dedicated session such as a transacted or InOut endpoint.
        Parameters:
        sessionCount - the number of Session instances, default is 1
      • getProducerCount

        public int getProducerCount()
      • setProducerCount

        public void setProducerCount​(int producerCount)
        Sets the number of producers used for this endpoint.
      • getConsumerCount

        public int getConsumerCount()
      • setConsumerCount

        public void setConsumerCount​(int consumerCount)
        Sets the number of consumer listeners used for this endpoint.
      • getTtl

        public long getTtl()
      • setTtl

        public void setTtl​(long ttl)
        Flag used to adjust the Time To Live value of produced messages.
      • isPersistent

        public boolean isPersistent()
      • setPersistent

        public void setPersistent​(boolean persistent)
        Flag used to enable/disable message persistence.
      • getDurableSubscriptionId

        public String getDurableSubscriptionId()
      • setDurableSubscriptionId

        public void setDurableSubscriptionId​(String durableSubscriptionId)
        Sets the durable subscription Id required for durable topics.
      • getResponseTimeOut

        public long getResponseTimeOut()
      • setResponseTimeOut

        public void setResponseTimeOut​(long responseTimeOut)
        Sets the amount of time we should wait before timing out a InOut response.
      • getMessageSelector

        public String getMessageSelector()
      • setMessageSelector

        public void setMessageSelector​(String messageSelector)
        Sets the JMS Message selector syntax.
      • getTransactionBatchCount

        public int getTransactionBatchCount()
      • setTransactionBatchCount

        public void setTransactionBatchCount​(int transactionBatchCount)
        If transacted sets the number of messages to process before committing a transaction.
      • getTransactionBatchTimeout

        public long getTransactionBatchTimeout()
      • setTransactionBatchTimeout

        public void setTransactionBatchTimeout​(long transactionBatchTimeout)
        Sets timeout (in millis) for batch transactions, the value should be 1000 or higher.
      • setTransactionCommitStrategy

        public void setTransactionCommitStrategy​(TransactionCommitStrategy transactionCommitStrategy)
        Sets the commit strategy.
      • isTransacted

        public boolean isTransacted()
      • setTransacted

        public void setTransacted​(boolean transacted)
        Specifies whether to use transacted mode
      • isSharedJMSSession

        public boolean isSharedJMSSession()
      • setSharedJMSSession

        public void setSharedJMSSession​(boolean share)
        Specifies whether to share JMS session with other SJMS endpoints. Turn this off if your route is accessing to multiple JMS providers. If you need transaction against multiple JMS providers, use jms component to leverage XA transaction.
      • getNamedReplyTo

        public String getNamedReplyTo()
      • setNamedReplyTo

        public void setNamedReplyTo​(String namedReplyTo)
        Sets the reply to destination name used for InOut producer endpoints. The type of the reply to destination can be determined by the starting prefix (topic: or queue:) in its name.
      • setAsyncStartListener

        public void setAsyncStartListener​(boolean asyncStartListener)
        Whether to startup the consumer message listener asynchronously, when starting a route. For example if a JmsConsumer cannot get a connection to a remote JMS broker, then it may block while retrying and/or failover. This will cause Camel to block while starting routes. By setting this option to true, you will let routes startup, while the JmsConsumer connects to the JMS broker using a dedicated thread in asynchronous mode. If this option is used, then beware that if the connection could not be established, then an exception is logged at WARN level, and the consumer will not be able to receive messages; You can then restart the route to retry.
      • setAsyncStopListener

        public void setAsyncStopListener​(boolean asyncStopListener)
        Whether to stop the consumer message listener asynchronously, when stopping a route.
      • isAsyncStartListener

        public boolean isAsyncStartListener()
      • isAsyncStopListener

        public boolean isAsyncStopListener()
      • isPrefillPool

        public boolean isPrefillPool()
      • setPrefillPool

        public void setPrefillPool​(boolean prefillPool)
        Whether to prefill the producer connection pool on startup, or create connections lazy when needed.
      • setDestinationCreationStrategy

        public void setDestinationCreationStrategy​(DestinationCreationStrategy destinationCreationStrategy)
        To use a custom DestinationCreationStrategy.
      • isAllowNullBody

        public boolean isAllowNullBody()
      • setAllowNullBody

        public void setAllowNullBody​(boolean allowNullBody)
        Whether to allow sending messages with no body. If this option is false and the message body is null, then an JMSException is thrown.
      • isMapJmsMessage

        public boolean isMapJmsMessage()
      • setMapJmsMessage

        public void setMapJmsMessage​(boolean mapJmsMessage)
        Specifies whether Camel should auto map the received JMS message to a suited payload type, such as javax.jms.TextMessage to a String etc. See section about how mapping works below for more details.
      • setMessageCreatedStrategy

        public void setMessageCreatedStrategy​(MessageCreatedStrategy messageCreatedStrategy)
        To use the given MessageCreatedStrategy which are invoked when Camel creates new instances of javax.jms.Message objects when Camel is sending a JMS message.
      • setJmsKeyFormatStrategy

        public void setJmsKeyFormatStrategy​(JmsKeyFormatStrategy jmsKeyFormatStrategy)
        Pluggable strategy for encoding and decoding JMS keys so they can be compliant with the JMS specification. Camel provides two implementations out of the box: default and passthrough. The default strategy will safely marshal dots and hyphens (. and -). The passthrough strategy leaves the key as is. Can be used for JMS brokers which do not care whether JMS header keys contain illegal characters. You can provide your own implementation of the org.apache.camel.component.jms.JmsKeyFormatStrategy and refer to it using the # notation.
      • setConnectionFactory

        public void setConnectionFactory​(javax.jms.ConnectionFactory connectionFactory)
        Initializes the connectionFactory for the endpoint, which takes precedence over the component's connectionFactory, if any
      • setConnectionFactory

        public void setConnectionFactory​(String connectionFactory)
      • getConnectionFactory

        public javax.jms.ConnectionFactory getConnectionFactory()
      • getConnectionCount

        public int getConnectionCount()
      • setConnectionCount

        public void setConnectionCount​(Integer connectionCount)
        The maximum number of connections available to this endpoint
      • getExceptionListener

        public javax.jms.ExceptionListener getExceptionListener()
      • setExceptionListener

        public void setExceptionListener​(javax.jms.ExceptionListener exceptionListener)
        Specifies the JMS Exception Listener that is to be notified of any underlying JMS exceptions.
      • getErrorHandlerLoggingLevel

        public org.apache.camel.LoggingLevel getErrorHandlerLoggingLevel()
      • setErrorHandlerLoggingLevel

        public void setErrorHandlerLoggingLevel​(org.apache.camel.LoggingLevel errorHandlerLoggingLevel)
        Allows to configure the default errorHandler logging level for logging uncaught exceptions.
      • isErrorHandlerLogStackTrace

        public boolean isErrorHandlerLogStackTrace()
      • setErrorHandlerLogStackTrace

        public void setErrorHandlerLogStackTrace​(boolean errorHandlerLogStackTrace)
        Allows to control whether stacktraces should be logged or not, by the default errorHandler.
      • setJmsObjectFactory

        public void setJmsObjectFactory​(JmsObjectFactory jmsObjectFactory)
        To use a custom Jms Object factory
      • isReconnectOnError

        public boolean isReconnectOnError()
      • setReconnectOnError

        public void setReconnectOnError​(boolean reconnectOnError)
        Try to apply reconnection logic on consumer pool
      • getReconnectBackOff

        public long getReconnectBackOff()
      • setReconnectBackOff

        public void setReconnectBackOff​(long reconnectBackOff)
        Backoff in millis on consumer pool reconnection attempts