Writing message to HornetQ
jdestef Jul 24, 2012 11:05 PMHi,
I'm trying to use a reference to write a message to a HornetQ queue. The basic flow is consume an HL7 message using the MLLP protocol the MessageReaderServiceBean. The referenced serverPipelineFactory below ("pipeline") is a custom Netty pipleing that can consume HL7 messages and also provides TLS/SSL connection. The MessageReaderServiceBean references the QueueServiceBean whhich I believe to be wired, through the PixInboundReference, to a queue. The MessageReaderServiceBean calls the QueueServiceBean. My switchyard.xml is as follows:
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<switchyard xmlns="urn:switchyard-config:switchyard:1.0" xmlns:_1="urn:switchyard-component-jca:config:1.0" xmlns:bean="urn:switchyard-component-bean:config:1.0" xmlns:camel="urn:switchyard-component-camel:config:1.0" xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" name="test_hl7" targetNamespace="urn:com.example.switchyard:test_hl7:0.0.1-SNAPSHOT">
<sca:composite name="test_hl7" targetNamespace="urn:com.example.switchyard:test_hl7:0.0.1-SNAPSHOT">
<sca:service name="MessageReaderService" promote="MessageReaderServiceBean/MessageReaderService">
<sca:interface.java interface="com.example.switchyard.test_hl7.MessageReaderService"/>
<camel:binding.camel configURI="netty:tcp://localhost:8888?sync=true&reuseAddress=false&serverPipelineFactory=#pipeline">
<camel:operationSelector operationName="readMessage"/>
</camel:binding.camel>
</sca:service>
<sca:reference name="PixInboundReference" multiplicity="1..1" promote="QueueServiceBean/PixInboundReference">
<_1:binding.jca>
<_1:outboundConnection>
<_1:resourceAdapter name="hornetq-ra.rar"/>
<_1:connection jndiName="java:/JmsXA"/>
</_1:outboundConnection>
<_1:outboundInteraction>
<_1:processor type="org.switchyard.component.jca.processor.JMSProcessor">
<_1:property name="destination" value="queue/PixInboundQueue"/>
</_1:processor>
</_1:outboundInteraction>
</_1:binding.jca>
</sca:reference>
<sca:component name="MessageReaderServiceBean">
<bean:implementation.bean class="com.example.switchyard.test_hl7.MessageReaderServiceBean"/>
<sca:service name="MessageReaderService">
<sca:interface.java interface="com.example.switchyard.test_hl7.MessageReaderService"/>
</sca:service>
<sca:reference name="QueueService">
<sca:interface.java interface="com.example.switchyard.test_hl7.QueueService"/>
</sca:reference>
</sca:component>
<sca:component name="QueueServiceBean">
<bean:implementation.bean class="com.example.switchyard.test_hl7.QueueServiceBean"/>
<sca:service name="QueueService">
<sca:interface.java interface="com.example.switchyard.test_hl7.QueueService"/>
</sca:service>
<sca:reference name="PixInboundReference">
<sca:interface.java interface="com.example.switchyard.test_hl7.QueueService"/>
</sca:reference>
</sca:component>
</sca:composite>
<domain>
<handlers>
<handler class="org.switchyard.handlers.MessageTrace" name="MessageTrace"/>
</handlers>
</domain>
</switchyard>
{code}
I'm using Switchyard 0.5. The QueueServiceBean class is as follows:
{code}
@Service(QueueService.class)
public class QueueServiceBean implements QueueService {
@Inject
@Reference("PixInboundReference")
public QueueService queueService;
public QueueServiceBean() {
}
@Override
public void queueMsg(String msg) throws Exception {
queueService.queueMsg(msg);
}
}
{code}
Any ideas why is doesn't work? Any help would be appreciated.
Thanks