org.logicblaze.lingo.jms
Class JmsServiceExporterMessageListener

java.lang.Object
  extended by org.springframework.remoting.support.RemoteExporter
      extended by org.springframework.remoting.support.RemoteInvocationBasedExporter
          extended by org.logicblaze.lingo.jms.JmsServiceExporterMessageListener
All Implemented Interfaces:
javax.jms.MessageListener, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean
Direct Known Subclasses:
AsyncReplyHandler, JmsServiceExporter, JmsTemplateServiceExporter

public class JmsServiceExporterMessageListener
extends org.springframework.remoting.support.RemoteInvocationBasedExporter
implements javax.jms.MessageListener, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean

A JMS MessageListener that exports the specified service bean as a JMS service endpoint, accessible via a JMS proxy.

Note: JMS services exported with this class can be accessed by any JMS client, as there isn't any special handling involved.

Version:
$Revision: 175 $
Author:
James Strachan
See Also:
JmsProxyFactoryBean

Field Summary
 
Fields inherited from class org.springframework.remoting.support.RemoteExporter
logger
 
Constructor Summary
JmsServiceExporterMessageListener()
           
JmsServiceExporterMessageListener(java.lang.Object proxy)
           
 
Method Summary
 void afterPropertiesSet()
           
protected  java.lang.Object createRemoteProxy(javax.jms.Message message, java.lang.Class parameterType, java.lang.Object argument)
           
protected  javax.jms.Message createResponseMessage(javax.jms.Session session, javax.jms.Message message, org.springframework.remoting.support.RemoteInvocationResult result)
          Creates the invocation result response message
 void destroy()
           
protected  void doInvoke(javax.jms.Message message, org.springframework.remoting.support.RemoteInvocation invocation)
           
 java.lang.String getClientID()
           
 javax.jms.ConnectionFactory getConnectionFactory()
           
 org.springframework.remoting.support.RemoteInvocationFactory getInvocationFactory()
           
 Marshaller getMarshaller()
           
 MetadataStrategy getMetadataStrategy()
           
 JmsProducerConfig getProducerConfig()
           
 java.lang.Object getProxy()
           
 Requestor getResponseRequestor()
           
protected  void introduceRemoteReferences(LingoInvocation invocation, javax.jms.Message requestMessage)
          Lets replace any remote object correlation IDs with dynamic proxies
 boolean isIgnoreFailures()
           
 boolean isPersistentDelivery()
           
protected  void onException(javax.jms.Message message, javax.jms.JMSException e)
          Handle the processing of an exception when processing an inbound messsage
 void onMessage(javax.jms.Message message)
           
 void setClientID(java.lang.String clientID)
          Sets the JMS connections unique clientID.
 void setConnectionFactory(javax.jms.ConnectionFactory connectionFactory)
          Used to create a default JmsProducer if no producer is explicitly configured.
 void setIgnoreFailures(boolean ignoreFailures)
          Sets whether or not failures should be ignored (and just logged) or thrown as runtime exceptions into the JMS provider
 void setInvocationFactory(org.springframework.remoting.support.RemoteInvocationFactory invocationFactory)
           
 void setMarshaller(Marshaller marshaller)
           
 void setMetadataStrategy(MetadataStrategy metadataStrategy)
           
 void setPersistentDelivery(boolean persistent)
          Sets the delivery mode to be persistent or non-persistent.
 void setProducerConfig(JmsProducerConfig producerConfig)
          Sets the configuration of the producer used to send back responses
 void setResponseRequestor(Requestor responseRequestor)
           
protected  void writeRemoteInvocationResult(javax.jms.Message message, org.springframework.remoting.support.RemoteInvocationResult result)
          Send the given RemoteInvocationResult as a JMS message to the originator
 
Methods inherited from class org.springframework.remoting.support.RemoteInvocationBasedExporter
getRemoteInvocationExecutor, invoke, invokeAndCreateResult, setRemoteInvocationExecutor
 
Methods inherited from class org.springframework.remoting.support.RemoteExporter
checkService, checkServiceInterface, getExporterName, getProxyForService, getService, getServiceInterface, isRegisterTraceInterceptor, setRegisterTraceInterceptor, setService, setServiceInterface
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JmsServiceExporterMessageListener

public JmsServiceExporterMessageListener()

JmsServiceExporterMessageListener

public JmsServiceExporterMessageListener(java.lang.Object proxy)
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

onMessage

public void onMessage(javax.jms.Message message)
Specified by:
onMessage in interface javax.jms.MessageListener

destroy

public void destroy()
             throws java.lang.Exception
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Throws:
java.lang.Exception

getConnectionFactory

public javax.jms.ConnectionFactory getConnectionFactory()

setConnectionFactory

public void setConnectionFactory(javax.jms.ConnectionFactory connectionFactory)
Used to create a default JmsProducer if no producer is explicitly configured.


getResponseRequestor

public Requestor getResponseRequestor()

setResponseRequestor

public void setResponseRequestor(Requestor responseRequestor)

getMarshaller

public Marshaller getMarshaller()

setMarshaller

public void setMarshaller(Marshaller marshaller)

getInvocationFactory

public org.springframework.remoting.support.RemoteInvocationFactory getInvocationFactory()

setInvocationFactory

public void setInvocationFactory(org.springframework.remoting.support.RemoteInvocationFactory invocationFactory)

isIgnoreFailures

public boolean isIgnoreFailures()

setIgnoreFailures

public void setIgnoreFailures(boolean ignoreFailures)
Sets whether or not failures should be ignored (and just logged) or thrown as runtime exceptions into the JMS provider


getProducerConfig

public JmsProducerConfig getProducerConfig()

setProducerConfig

public void setProducerConfig(JmsProducerConfig producerConfig)
Sets the configuration of the producer used to send back responses


isPersistentDelivery

public boolean isPersistentDelivery()

setPersistentDelivery

public void setPersistentDelivery(boolean persistent)
Sets the delivery mode to be persistent or non-persistent.


getClientID

public java.lang.String getClientID()

setClientID

public void setClientID(java.lang.String clientID)
Sets the JMS connections unique clientID. This is optional unless you wish to use durable topic subscriptions. Only one connection can have a given clientID at any time.


getProxy

public java.lang.Object getProxy()

getMetadataStrategy

public MetadataStrategy getMetadataStrategy()

setMetadataStrategy

public void setMetadataStrategy(MetadataStrategy metadataStrategy)

doInvoke

protected void doInvoke(javax.jms.Message message,
                        org.springframework.remoting.support.RemoteInvocation invocation)
                 throws javax.jms.JMSException
Throws:
javax.jms.JMSException

createResponseMessage

protected javax.jms.Message createResponseMessage(javax.jms.Session session,
                                                  javax.jms.Message message,
                                                  org.springframework.remoting.support.RemoteInvocationResult result)
                                           throws javax.jms.JMSException
Creates the invocation result response message

Parameters:
session - the JMS session to use
message - the original request message, in case we want to attach any properties etc.
result - the invocation result
Returns:
the message response to send
Throws:
javax.jms.JMSException - if creating the messsage failed

introduceRemoteReferences

protected void introduceRemoteReferences(LingoInvocation invocation,
                                         javax.jms.Message requestMessage)
                                  throws javax.jms.JMSException
Lets replace any remote object correlation IDs with dynamic proxies

Parameters:
invocation -
requestMessage -
Throws:
javax.jms.JMSException

createRemoteProxy

protected java.lang.Object createRemoteProxy(javax.jms.Message message,
                                             java.lang.Class parameterType,
                                             java.lang.Object argument)
                                      throws javax.jms.JMSException
Throws:
javax.jms.JMSException

onException

protected void onException(javax.jms.Message message,
                           javax.jms.JMSException e)
Handle the processing of an exception when processing an inbound messsage


writeRemoteInvocationResult

protected void writeRemoteInvocationResult(javax.jms.Message message,
                                           org.springframework.remoting.support.RemoteInvocationResult result)
                                    throws javax.jms.JMSException
Send the given RemoteInvocationResult as a JMS message to the originator

Parameters:
message - current HTTP message
result - the RemoteInvocationResult object
Throws:
javax.jms.JMSException - if thrown by trying to send the message


Copyright © 2011 LogicBlaze, Inc.. All Rights Reserved.