seperate inbound and outbound message convertors

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@375088 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2006-02-05 19:58:14 +00:00
parent bf8f99b51d
commit 6ea186cf65
4 changed files with 37 additions and 22 deletions

View File

@ -56,15 +56,15 @@ abstract class DestinationBridge implements Service,MessageListener{
}
/**
* @return Returns the jmsMessageConvertor.
* @return Returns the inboundMessageConvertor.
*/
public JmsMesageConvertor getJmsMessageConvertor(){
return jmsMessageConvertor;
}
/**
* @param jmsMessageConvertor
* The jmsMessageConvertor to set.
* @param inboundMessageConvertor
* The inboundMessageConvertor to set.
*/
public void setJmsMessageConvertor(JmsMesageConvertor jmsMessageConvertor){
this.jmsMessageConvertor=jmsMessageConvertor;
@ -95,9 +95,6 @@ abstract class DestinationBridge implements Service,MessageListener{
message.setJMSReplyTo(null);
}
Message converted=jmsMessageConvertor.convert(message);
if (converted == message && converted instanceof ActiveMQMessage){
converted = (Message) ((ActiveMQMessage)converted).copy();
}
sendMessage(converted);
message.acknowledge();
}catch(JMSException e){

View File

@ -40,7 +40,8 @@ public abstract class JmsConnector implements Service{
private static final Log log=LogFactory.getLog(JmsConnector.class);
protected JndiTemplate jndiLocalTemplate;
protected JndiTemplate jndiOutboundTemplate;
protected JmsMesageConvertor jmsMessageConvertor;
protected JmsMesageConvertor inboundMessageConvertor;
protected JmsMesageConvertor outboundMessageConvertor;
private List inboundBridges = new CopyOnWriteArrayList();
private List outboundBridges = new CopyOnWriteArrayList();
protected int replyToDestinationCacheSize=10000;
@ -74,8 +75,11 @@ public abstract class JmsConnector implements Service{
if(jndiOutboundTemplate==null){
jndiOutboundTemplate=new JndiTemplate();
}
if(jmsMessageConvertor==null){
jmsMessageConvertor=new SimpleJmsMessageConvertor();
if(inboundMessageConvertor==null){
inboundMessageConvertor=new SimpleJmsMessageConvertor();
}
if (outboundMessageConvertor==null){
outboundMessageConvertor=new SimpleJmsMessageConvertor();
}
replyToBridges.setMaxCacheSize(getReplyToDestinationCacheSize());
}
@ -148,18 +152,32 @@ public abstract class JmsConnector implements Service{
}
/**
* @return Returns the jmsMessageConvertor.
* @return Returns the inboundMessageConvertor.
*/
public JmsMesageConvertor getJmsMessageConvertor(){
return jmsMessageConvertor;
public JmsMesageConvertor getInboundMessageConvertor(){
return inboundMessageConvertor;
}
/**
* @param jmsMessageConvertor
* The jmsMessageConvertor to set.
* @param inboundMessageConvertor
* The inboundMessageConvertor to set.
*/
public void setJmsMessageConvertor(JmsMesageConvertor jmsMessageConvertor){
this.jmsMessageConvertor=jmsMessageConvertor;
public void setInboundMessageConvertor(JmsMesageConvertor jmsMessageConvertor){
this.inboundMessageConvertor=jmsMessageConvertor;
}
/**
* @return Returns the outboundMessageConvertor.
*/
public JmsMesageConvertor getOutboundMessageConvertor(){
return outboundMessageConvertor;
}
/**
* @param outboundMessageConvertor The outboundMessageConvertor to set.
*/
public void setOutboundMessageConvertor(JmsMesageConvertor outboundMessageConvertor){
this.outboundMessageConvertor=outboundMessageConvertor;
}
/**

View File

@ -339,7 +339,7 @@ public class JmsQueueConnector extends JmsConnector{
bridge.setProducerConnection(localQueueConnection);
bridge.setConsumerConnection(outboundQueueConnection);
if(bridge.getJmsMessageConvertor()==null){
bridge.setJmsMessageConvertor(getJmsMessageConvertor());
bridge.setJmsMessageConvertor(getInboundMessageConvertor());
}
bridge.setJmsQueueConnector(this);
addInboundBridge(bridge);
@ -364,7 +364,7 @@ public class JmsQueueConnector extends JmsConnector{
bridge.setConsumerConnection(localQueueConnection);
bridge.setDoHandleReplyTo(false);
if(bridge.getJmsMessageConvertor()==null){
bridge.setJmsMessageConvertor(getJmsMessageConvertor());
bridge.setJmsMessageConvertor(getOutboundMessageConvertor());
}
bridge.setJmsQueueConnector(this);
addOutboundBridge(bridge);
@ -393,7 +393,7 @@ public class JmsQueueConnector extends JmsConnector{
bridge.setConsumerConnection(localQueueConnection);
bridge.setDoHandleReplyTo(false);
if(bridge.getJmsMessageConvertor()==null){
bridge.setJmsMessageConvertor(getJmsMessageConvertor());
bridge.setJmsMessageConvertor(getOutboundMessageConvertor());
}
bridge.setJmsQueueConnector(this);
bridge.start();

View File

@ -339,7 +339,7 @@ public class JmsTopicConnector extends JmsConnector{
bridge.setProducerConnection(localTopicConnection);
bridge.setConsumerConnection(outboundTopicConnection);
if(bridge.getJmsMessageConvertor()==null){
bridge.setJmsMessageConvertor(getJmsMessageConvertor());
bridge.setJmsMessageConvertor(getInboundMessageConvertor());
}
bridge.setJmsTopicConnector(this);
addInboundBridge(bridge);
@ -364,7 +364,7 @@ public class JmsTopicConnector extends JmsConnector{
bridge.setConsumerConnection(localTopicConnection);
bridge.setDoHandleReplyTo(false);
if(bridge.getJmsMessageConvertor()==null){
bridge.setJmsMessageConvertor(getJmsMessageConvertor());
bridge.setJmsMessageConvertor(getOutboundMessageConvertor());
}
bridge.setJmsTopicConnector(this);
addOutboundBridge(bridge);
@ -393,7 +393,7 @@ public class JmsTopicConnector extends JmsConnector{
bridge.setConsumerConnection(localTopicConnection);
bridge.setDoHandleReplyTo(false);
if(bridge.getJmsMessageConvertor()==null){
bridge.setJmsMessageConvertor(getJmsMessageConvertor());
bridge.setJmsMessageConvertor(getOutboundMessageConvertor());
}
bridge.setJmsTopicConnector(this);
bridge.start();