org.apache.servicemix.jms.endpoints
Class AbstractConsumerEndpoint

java.lang.Object
  extended by org.apache.servicemix.common.endpoints.AbstractEndpoint
      extended by org.apache.servicemix.common.endpoints.SimpleEndpoint
          extended by org.apache.servicemix.common.endpoints.ConsumerEndpoint
              extended by org.apache.servicemix.jms.endpoints.AbstractConsumerEndpoint
All Implemented Interfaces:
Endpoint
Direct Known Subclasses:
JmsConsumerEndpoint, JmsJcaConsumerEndpoint

public abstract class AbstractConsumerEndpoint
extends ConsumerEndpoint

The base class for Spring-based JMS consumer endpoints.


Field Summary
protected static java.lang.String PROP_JMS_CONTEXT
           
 
Fields inherited from class org.apache.servicemix.common.endpoints.SimpleEndpoint
logger
 
Fields inherited from class org.apache.servicemix.common.endpoints.AbstractEndpoint
definition, description, endpoint, interfaceName, service, serviceUnit
 
Constructor Summary
AbstractConsumerEndpoint()
           
AbstractConsumerEndpoint(DefaultComponent component, javax.jbi.servicedesc.ServiceEndpoint endpoint)
           
AbstractConsumerEndpoint(ServiceUnit serviceUnit, javax.xml.namespace.QName service, java.lang.String endpoint)
           
 
Method Summary
 void activate()
           
 void deactivate()
           
 javax.jms.ConnectionFactory getConnectionFactory()
           
 DestinationChooser getDestinationChooser()
           
 org.springframework.jms.support.destination.DestinationResolver getDestinationResolver()
           
 java.lang.String getLocationURI()
           
 JmsConsumerMarshaler getMarshaler()
           
 int getReplyDeliveryMode()
           
 javax.jms.Destination getReplyDestination()
           
protected  javax.jms.Destination getReplyDestination(javax.jbi.messaging.MessageExchange exchange, java.lang.Object message, javax.jms.Session session, JmsConsumerMarshaler.JmsContext context)
           
 java.lang.String getReplyDestinationName()
           
 int getReplyPriority()
           
 java.util.Map<java.lang.String,java.lang.Object> getReplyProperties()
           
 long getReplyTimeToLive()
           
 org.apache.servicemix.store.Store getStore()
           
 org.apache.servicemix.store.StoreFactory getStoreFactory()
           
 java.lang.Boolean getUseMessageIdInResponse()
           
protected  void handleException(javax.jbi.messaging.MessageExchange exchange, java.lang.Exception error, javax.jms.Session session, JmsConsumerMarshaler.JmsContext context)
           
 boolean isJms102()
           
 boolean isPubSubDomain()
           
 boolean isReplyExplicitQosEnabled()
           
 boolean isStateless()
           
 boolean isSynchronous()
           
protected  void onMessage(javax.jms.Message jmsMessage, javax.jms.Session session)
           
 void process(javax.jbi.messaging.MessageExchange exchange)
           
protected  void processExchange(javax.jbi.messaging.MessageExchange exchange, javax.jms.Session session, JmsConsumerMarshaler.JmsContext context)
           
protected  void send(javax.jms.Message msg, javax.jms.Session session, javax.jms.Destination dest)
           
protected  void sendError(javax.jbi.messaging.MessageExchange exchange, java.lang.Exception error, javax.jms.Session session, JmsConsumerMarshaler.JmsContext context)
           
 void setConnectionFactory(javax.jms.ConnectionFactory connectionFactory)
          Specifies the ConnectionFactory used by the endpoint.
protected  void setCorrelationId(javax.jms.Message query, javax.jms.Message reply)
           
 void setDestinationChooser(DestinationChooser destinationChooser)
          Specifies a class implementing logic for choosing reply destinations.
 void setDestinationResolver(org.springframework.jms.support.destination.DestinationResolver destinationResolver)
          Specifies the class implementing logic for converting strings into destinations.
 void setJms102(boolean jms102)
          Specifies if the consumer uses JMS 1.0.2 compliant APIs.
 void setMarshaler(JmsConsumerMarshaler marshaler)
          Specifies the class implementing the message marshaler.
 void setPubSubDomain(boolean pubSubDomain)
          Specifies if the destination is a topic.
 void setReplyDeliveryMode(int replyDeliveryMode)
          Specifies the JMS delivery mode used for the reply.
 void setReplyDestination(javax.jms.Destination replyDestination)
          Specifies the JMS Destination for the replies.
 void setReplyDestinationName(java.lang.String replyDestinationName)
          Specifies the name of the JMS destination to use for the reply.
 void setReplyExplicitQosEnabled(boolean replyExplicitQosEnabled)
          Specifies if the QoS values specified for the endpoint are explicitly used when the reply is sent.
 void setReplyPriority(int replyPriority)
          Specifies the JMS message priority of the reply.
 void setReplyProperties(java.util.Map<java.lang.String,java.lang.Object> replyProperties)
          Specifies custom properties to be placed in the reply's JMS header.
 void setReplyTimeToLive(long replyTimeToLive)
          Specifies the number of milliseconds the reply message is valid.
 void setStateless(boolean stateless)
          Specifies if the consumer retains state information about the message exchange while it is in process.
 void setStore(org.apache.servicemix.store.Store store)
          Specifies the persistent store used to store JBI exchanges that are waiting to be processed.
 void setStoreFactory(org.apache.servicemix.store.StoreFactory storeFactory)
          Specifies the store factory used to create the store.
 void setSynchronous(boolean synchronous)
          Specifies if the consumer will block while waiting for a response.
 void setUseMessageIdInResponse(java.lang.Boolean useMessageIdInResponse)
          Specifies if the request message's ID is used as the reply's correlation ID.
protected  boolean treatExceptionAsFault(java.lang.Exception error)
           
 
Methods inherited from class org.apache.servicemix.common.endpoints.ConsumerEndpoint
configureExchangeTarget, getRole, getTargetEndpoint, getTargetInterface, getTargetOperation, getTargetService, getTargetUri, setTargetEndpoint, setTargetInterface, setTargetOperation, setTargetService, setTargetUri, validate
 
Methods inherited from class org.apache.servicemix.common.endpoints.SimpleEndpoint
done, fail, getChannel, getContext, getExchangeFactory, send, sendSync, start, stop
 
Methods inherited from class org.apache.servicemix.common.endpoints.AbstractEndpoint
getDefinition, getDescription, getEndpoint, getInterfaceName, getKey, getService, getServiceUnit, isExchangeOkay, prepareExchange, setDefinition, setDescription, setEndpoint, setInterfaceName, setService, setServiceUnit, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROP_JMS_CONTEXT

protected static final java.lang.String PROP_JMS_CONTEXT
Constructor Detail

AbstractConsumerEndpoint

public AbstractConsumerEndpoint()

AbstractConsumerEndpoint

public AbstractConsumerEndpoint(DefaultComponent component,
                                javax.jbi.servicedesc.ServiceEndpoint endpoint)

AbstractConsumerEndpoint

public AbstractConsumerEndpoint(ServiceUnit serviceUnit,
                                javax.xml.namespace.QName service,
                                java.lang.String endpoint)
Method Detail

getDestinationChooser

public DestinationChooser getDestinationChooser()
Returns:
the destinationChooser

setDestinationChooser

public void setDestinationChooser(DestinationChooser destinationChooser)
Specifies a class implementing logic for choosing reply destinations.

Parameters:
destinationChooser - the destinationChooser to set

getReplyDeliveryMode

public int getReplyDeliveryMode()
Returns:
the replyDeliveryMode

setReplyDeliveryMode

public void setReplyDeliveryMode(int replyDeliveryMode)
Specifies the JMS delivery mode used for the reply. Defaults to 2(PERSISTENT).

Parameters:
replyDeliveryMode - the JMS delivery mode

getReplyDestination

public javax.jms.Destination getReplyDestination()
Returns:
the replyDestination

setReplyDestination

public void setReplyDestination(javax.jms.Destination replyDestination)
Specifies the JMS Destination for the replies. If this value is not set the endpoint will use the destinationChooser property or the replyDestinationName property to determine the desitination to use.

Parameters:
replyDestination - the JMS destination for replies

getReplyDestinationName

public java.lang.String getReplyDestinationName()
Returns:
the replyDestinationName

setReplyDestinationName

public void setReplyDestinationName(java.lang.String replyDestinationName)
Specifies the name of the JMS destination to use for the reply. The actual JMS destination is resolved using the DestinationResolver specified by the .destinationResolver property.

Parameters:
replyDestinationName - the name of the reply destination

isReplyExplicitQosEnabled

public boolean isReplyExplicitQosEnabled()
Returns:
the replyExplicitQosEnabled

setReplyExplicitQosEnabled

public void setReplyExplicitQosEnabled(boolean replyExplicitQosEnabled)
Specifies if the QoS values specified for the endpoint are explicitly used when the reply is sent. The default is false.

Parameters:
replyExplicitQosEnabled - should the QoS values be sent?

getReplyPriority

public int getReplyPriority()
Returns:
the replyPriority

setReplyPriority

public void setReplyPriority(int replyPriority)
Specifies the JMS message priority of the reply. Defaults to 4.

Parameters:
replyPriority - the reply's priority

getReplyProperties

public java.util.Map<java.lang.String,java.lang.Object> getReplyProperties()
Returns:
the replyProperties

setReplyProperties

public void setReplyProperties(java.util.Map<java.lang.String,java.lang.Object> replyProperties)
Specifies custom properties to be placed in the reply's JMS header.

Parameters:
replyProperties - the properties to set

getReplyTimeToLive

public long getReplyTimeToLive()
Returns:
the replyTimeToLive

setReplyTimeToLive

public void setReplyTimeToLive(long replyTimeToLive)
Specifies the number of milliseconds the reply message is valid. The default is unlimited.

Parameters:
replyTimeToLive - the number of milliseonds the message lives

getUseMessageIdInResponse

public java.lang.Boolean getUseMessageIdInResponse()
Returns:
the useMessageIdInResponse

setUseMessageIdInResponse

public void setUseMessageIdInResponse(java.lang.Boolean useMessageIdInResponse)
Specifies if the request message's ID is used as the reply's correlation ID. The default behavior is to use the request's correlation ID. Setting this to true means the request's message ID will be used instead.

Parameters:
useMessageIdInResponse - use the request's message ID as the reply'e correlation ID?

getConnectionFactory

public javax.jms.ConnectionFactory getConnectionFactory()
Returns:
the connectionFactory

setConnectionFactory

public void setConnectionFactory(javax.jms.ConnectionFactory connectionFactory)
Specifies the ConnectionFactory used by the endpoint.

Parameters:
connectionFactory - the connectionFactory to set

isPubSubDomain

public boolean isPubSubDomain()
Returns:
the pubSubDomain

setPubSubDomain

public void setPubSubDomain(boolean pubSubDomain)
Specifies if the destination is a topic. true means the destination is a topic. false means the destination is a queue.

Parameters:
pubSubDomain - the destination is a topic?

getDestinationResolver

public org.springframework.jms.support.destination.DestinationResolver getDestinationResolver()
Returns:
the destinationResolver

setDestinationResolver

public void setDestinationResolver(org.springframework.jms.support.destination.DestinationResolver destinationResolver)
Specifies the class implementing logic for converting strings into destinations. The default is DynamicDestinationResolver.

Parameters:
destinationResolver - the destination resolver implementation

getMarshaler

public JmsConsumerMarshaler getMarshaler()
Returns:
the marshaler

setMarshaler

public void setMarshaler(JmsConsumerMarshaler marshaler)
Specifies the class implementing the message marshaler. The message marshaller is responsible for marshalling and unmarshalling JMS messages. The default is DefaultConsumerMarshaler.

Parameters:
marshaler - the marshaler implementation

isSynchronous

public boolean isSynchronous()
Returns:
the synchronous

setSynchronous

public void setSynchronous(boolean synchronous)
Specifies if the consumer will block while waiting for a response. This means the consumer can only process one message at a time. Defaults to true.

Parameters:
synchronous - the consumer blocks?

isStateless

public boolean isStateless()

setStateless

public void setStateless(boolean stateless)
Specifies if the consumer retains state information about the message exchange while it is in process.

Parameters:
stateless - the consumer retains state?

getStore

public org.apache.servicemix.store.Store getStore()

setStore

public void setStore(org.apache.servicemix.store.Store store)
Specifies the persistent store used to store JBI exchanges that are waiting to be processed. The store will be automatically created if not set and the endpoint's stateless property is set to false.

Parameters:
store - the Store object

getStoreFactory

public org.apache.servicemix.store.StoreFactory getStoreFactory()

setStoreFactory

public void setStoreFactory(org.apache.servicemix.store.StoreFactory storeFactory)
Specifies the store factory used to create the store. If none is set and the endpoint's stateless property is set to false, a MemoryStoreFactory will be created and used instead.

Parameters:
storeFactory - the StoreFactory object

getLocationURI

public java.lang.String getLocationURI()
Overrides:
getLocationURI in class ConsumerEndpoint

activate

public void activate()
              throws java.lang.Exception
Specified by:
activate in interface Endpoint
Overrides:
activate in class ConsumerEndpoint
Throws:
java.lang.Exception

deactivate

public void deactivate()
                throws java.lang.Exception
Specified by:
deactivate in interface Endpoint
Overrides:
deactivate in class ConsumerEndpoint
Throws:
java.lang.Exception

process

public void process(javax.jbi.messaging.MessageExchange exchange)
             throws java.lang.Exception
Specified by:
process in interface Endpoint
Specified by:
process in class AbstractEndpoint
Throws:
java.lang.Exception

processExchange

protected void processExchange(javax.jbi.messaging.MessageExchange exchange,
                               javax.jms.Session session,
                               JmsConsumerMarshaler.JmsContext context)
                        throws java.lang.Exception
Throws:
java.lang.Exception

send

protected void send(javax.jms.Message msg,
                    javax.jms.Session session,
                    javax.jms.Destination dest)
             throws javax.jms.JMSException
Throws:
javax.jms.JMSException

onMessage

protected void onMessage(javax.jms.Message jmsMessage,
                         javax.jms.Session session)
                  throws javax.jms.JMSException
Throws:
javax.jms.JMSException

getReplyDestination

protected javax.jms.Destination getReplyDestination(javax.jbi.messaging.MessageExchange exchange,
                                                    java.lang.Object message,
                                                    javax.jms.Session session,
                                                    JmsConsumerMarshaler.JmsContext context)
                                             throws javax.jms.JMSException
Throws:
javax.jms.JMSException

setCorrelationId

protected void setCorrelationId(javax.jms.Message query,
                                javax.jms.Message reply)
                         throws java.lang.Exception
Throws:
java.lang.Exception

handleException

protected void handleException(javax.jbi.messaging.MessageExchange exchange,
                               java.lang.Exception error,
                               javax.jms.Session session,
                               JmsConsumerMarshaler.JmsContext context)
                        throws java.lang.Exception
Throws:
java.lang.Exception

treatExceptionAsFault

protected boolean treatExceptionAsFault(java.lang.Exception error)

sendError

protected void sendError(javax.jbi.messaging.MessageExchange exchange,
                         java.lang.Exception error,
                         javax.jms.Session session,
                         JmsConsumerMarshaler.JmsContext context)
                  throws java.lang.Exception
Throws:
java.lang.Exception

isJms102

public boolean isJms102()
Returns:
the jms102

setJms102

public void setJms102(boolean jms102)
Specifies if the consumer uses JMS 1.0.2 compliant APIs. Defaults to false.

Parameters:
jms102 - consumer is JMS 1.0.2 compliant?


Copyright © 2005-2014 FuseSource. All Rights Reserved.