activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Gross <a...@andygross.org>
Subject Re: Writing a custom (non-JMS) TCP protocol
Date Thu, 23 Oct 2008 15:01:30 GMT

James,

Thanks for the help!  I now have a Mina-based JSON request/response  
codec written.    It's unclear from reading the docs what the best way  
is to get this custom protocol working in ActiveMQ.  I'm assuming that  
it can be done via activemq.xml somehow, but my questions are:

1)  Where do I put my .jar so that ActiveMQ can see it?
2)  What are the next steps for transforming my custom JSON messages  
into JMS messages.   I'm assuming I need to write a Message  
Translator, but I'm not a Spring expert so it's hard to tell how to  
deploy and configure this thing.

Thanks,

Andy




On Oct 23, 2008, at 3:32 AM, James Strachan wrote:

> 2008/10/23 Andy Gross <andy@andygross.org>:
>> I'm currently using ActiveMQ in a mixed-language environment.   For  
>> the
>> non-Java clients, I hacked the Ajax/MessageListener servlet modules  
>> to
>> produce JSON and wrote clients using the HTTP client/JSON libraries  
>> of the
>> respective languages (basically translations of the Ajax long-poll  
>> example
>> in _amq.js).
>>
>> The mismatch between HTTP and JMS semantics, as well as the  
>> wierdnesses that
>> arise with HTTP servers, proxies and client libraries makes this  
>> approach
>> suboptimal.   I'd like to develop a custom JSON over TCP protocol  
>> that
>> encapsulates the subset of JMS that we need.   In other words, I'd  
>> like to
>> embed an NIO framework like Xsocket inside ActiveMQ and write  
>> connection
>> handlers for my protocol just like one writes Jetty servlets in the  
>> default
>> distribution.
>>
>> I've searched the wiki and mailing list archives pretty well and  
>> haven't
>> seen this question come up.  Any help (including pointers to code)  
>> would be
>> most appreciated.
>
> We created the Camel project for exactly this purpose - bridging
> between (say) JMS and any other protocol; be it a custom one or other
> ones like files/ftp/http/xmpp/fix etc.
>
> http://activemq.apache.org/camel/
>
> So for example you could use the MINA component
> http://activemq.apache.org/camel/mina.html
>
> and extend it to add in your own protocol codec (how to
> marshal/unmarshal messages on the socket with possibly using framing
> etc)
>
> The HL7 component is an example of doing this
> http://activemq.apache.org/camel/hl7.html
>
> more detail here
> http://mina.apache.org/tutorial-on-protocolcodecfilter.html
>
> Then once you've got your camel component (lets call it foo) you could
> then bridge to one or more queues in ActiveMQ using a variety of
> Enterprise Integration Patterns
> http://activemq.apache.org/camel/enterprise-integration-patterns.html
>
> such as Content Based Router, Recipient List, Routing Slip etc
>
> e.g. in Java code
>
> // route all messages from the foo component to a single queue
> from("foo://somehost:1234").to("activemq:MyQueue");
>
> // route all messages from the foo component to a queue using a
> 'cheese' header to route to the right queue
> from("foo://somehost: 
> 1234").recipientList().simple("activemq:MyPrefix.${headers.cheese}");
>
> -- 
> James
> -------
> http://macstrac.blogspot.com/
>
> Open Source Integration
> http://fusesource.com/


Mime
View raw message