Hello everyone,
I am trying to take my first steps with SI, which looks really promising for my needs. But unfortunately I am stucked trying to get around a problem.
What I am trying to do is to simulate the following situation:
- A fast producer
- A slow consumer
- A JMS-backed channel that connects them two and can buffer (on disk) messages for the slow consumer
My platform is OSGi(Equinox)-SI-ActiveMq.
The messages' payloads are just java.lang.String for testing purposes.
My beans configuration looks like this:
Code:
<bean id="jmsServer" class="org.apache.activemq.broker.BrokerService"
init-method="start">
<property name="persistent" value="false" />
<property name="transportConnectorURIs">
<list>
<value>vm://mybroker</value>
</list>
</property>
<property name="useJmx" value="false"/>
</bean>
<bean id="myConnectionFactory"
class="org.springframework.jms.connection.SingleConnectionFactory"
depends-on="jmsServer">
<property name="targetConnectionFactory">
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL"
value="vm://mybroker" />
</bean>
</property>
</bean>
<int-jms:channel id="jmsChannel" connection-factory="myConnectionFactory"
queue-name="repliesJmsQueue" cache="none" message-driven="false" />
<bean id="myMessageProducer" class="test_sjms.tests.MyMessageProducer"
depends-on="jmsChannel">
<property name="channel" ref="jmsChannel" />
</bean>
<bean id="myMessageReceiver" class="test_sjms.tests.MyMessageReceiver"
depends-on="jmsChannel">
<property name="channel" ref="jmsChannel" />
</bean>
As for my Java code, the sender:
Code:
String payload = someString; // some test String
Message<String> message = MessageBuilder.withPayload(payload).build();
this.channel.send(message);
And the receiver:
Both 'channel' members are instances of org.springframework.integration.core.PollableChann el.
When starting the application, the JMS broker starts up well and messages are sent into the queue normally. But at the receiver's side, when calling receive() on the channel, the following error happens:
Code:
javax.jms.JMSException: Failed to build body from bytes. Reason: java.io.IOException: org.springframework.integration.message.GenericMessage
at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)
at org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:183)
Perhaps I am missing something obvious, but this is driving me crazy.
I've seen a thread on a (maybe) similar subject,
http://forum.springsource.org/showthread.php?t=63106
But I wasn't able to make it help, since I am making my tests in a single VM (even in a single Equinox bundle).
I would appreciate very much any hint on this issue.
Thanking You in advance.
David