I have an issue with the camel-stomp component. When I transport String
messages over the stomp component and receive the String back from the Stomp
broker it is prepended with "ascii: ". Shouldn't Strings be received in the
same state they were sent?
Here is a hand-written (and likely full of errors) approximation of the code
we use:
package com.SomeCompany.SomeProject;
public class SomeClass {
@Produce(uri="seda:msgChannel")
private ProducerTemplate messageChannel;
public void someMethod() {
String msg = "hi there"
messageChannel.sendBody(msg)
}
public void handleMessage(String message) {
System.out.println(message)
// output: "ascii: hi there"
}
}
<beans>
<camelContext>
<route>
<from uri="seda:msgChannel?concurrentConsumers=1" />
<to uri="stomp:queue:stompMessage" />
</route>
<route>
<from uri="stomp:queue:stompMessage" />
<bean ref="someBean" method="handleMessage"/>
</route>
</camelContext>
<bean id="stomp"
class="org.apache.camel.component.stomp.StompComponent">
<property name="brokerURL" value="tcp://localhost:61613"/>
<property name="passcode" value="guest" />
<property name="login" value="guest" />
</bean>
<bean id="someBean" class="com.SomeCompany.SomeProject.SomeClass" />
</beans>
Digging a little deeper, when I modify the above to send Serializable
objects, I receive back org.fusesource.hawtbuf.Buffer objects instead of an
instance of the original class. For example if I sent an Animal object, I
get back a Buffer object whose toString method returns the toString of that
animal with "ascii: " prepended:
public class Animal implements Serializable {
public String toString() {
return "moo";
}
}
public class someOtherClass {
public void handleMessage(Buffer buffer) {
System.out.println(buffer)
// output: "ascii: moo"
}
}
If I send an object through the stomp-component, shouldn't I receive the
same object back on the other end?
Is there something I'm missing? I'm new to Camel so I'm likely doing
something wrong.
I'm using:
camel-stomp 2.12.2
Spring Framework 4.0 Release
RabbitMQ 3.2.2 with Stomp plugin as the Stomp Broker
JDK 1.7
--
View this message in context:
http://camel.465427.n5.nabble.com/Camel-Stomp-Component-Serialization-Issue-tp5746638.html
Sent from the Camel - Users mailing list archive at Nabble.com.