You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by lone squirrely <th...@gmail.com> on 2011/03/09 00:21:28 UTC
Using protobufs within Camel
Hey, I am aware that there some peculiarity in dealing with protobufs
and camel, I was wondering if you could help me figure out how I can
interface with an already working system?
They define a route that goes like this:
<!-- send Queries to MARS for report generation,
return response to
originator -->
<route id="Query_Service">
<from uri="activemq:db.query" />
<unmarshal ref="QueryProtobuf" />
<bean ref="dataQueryService" />
<marshal ref="QueryRspProtobuf" />
</route>
Where they use a work around:
<bean id="QueryProtobuf"
class="org.apache.camel.dataformat.protobuf.ProtobufDataFormat">
<property name="instanceClass"
value="com.project.protobuf.Msgs$Query" />
</bean>
and a similar way for the QueryRspProtobuf
This all works and they can send messages amongst themselves...
What I need to do is send a message from a difference context (same
proto type), but I don't get a response.
public QueryRsp requestReport (DataType dt, ReportType rt) {
Query.Builder queryBuilder = Query.newBuilder ();
/* .... */
Query query = queryBuilder.build ();
QueryRsp rsp = (QueryRsp) template.sendBody ("activemq:db.query",
ExchangePattern.InOut, query);
return rsp;
}
I setup no new routes, just a simple camel context (in Spring).
When I execute this method I get this error on the receiver side:
2011-03-08 15:07:24,116 [enerContainer-1] INFO Tracer
- >>> (Query_Service) from(activemq://db.query) --> <<<
Pattern:InOut, Headers:{JMSTimestamp=1299625644101, JMSPriority=4,
JMSCorrelationID=ID-<server>-37316-1299625642786-0-4,
JMSDestination=queue://db.query, JMSRedelivered=false,
JMSDeliveryMode=2, JMSExpiration=1299625664101,
JMSMessageID=ID:<server>-52837-1299625643564-0:2:2:1:1, JMSType=null,
JMSXGroupID=null,
JMSReplyTo=temp-queue://ID:<server>-52837-1299625643564-0:2:1},
BodyType:null
and on the sender side:
15:07:24,067 INFO TemporaryQueueReplyManager:215 - Starting reply
listener container on endpoint: Endpoint[activemq://db.query]
15:07:24,084 INFO JmsProducer:73 - Using JmsReplyManager:
org.apache.camel.component.jms.reply.TemporaryQueueReplyManager@2c7a6c34
to process replies from temporary queue
15:07:24,091 WARN JmsBinding:471 - Cannot determine specific
JmsMessage type to use from body class. Will use generic JmsMessage.
Body class: com.netrecon.proto.mars.DssMsgs.Query. If you want to send
a POJO then your class might need to implement java.io.Serializable,
or you can force a specific type by setting the jmsMessageType option
on the JMS endpoint.
I have looked at the example on the camel page:
http://camel.apache.org/protobuf.html and tried the second client
impl. on http://camel.apache.org/tutorial-jmsremoting.html. tp mp
avao;/
but that looks like it is to setup another route (like the original
XML). Should I consider setting up an intermediary queue
(direct:protostart) that will feed the marshalled version along?
Please help! Thanks!!