You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by optimist <op...@gmail.com> on 2013/03/18 02:00:44 UTC

routing private chat xmpp messages to camel route

I am trying to setup a camel(2.9.5) based bot to move messages from xmpp
users to JMS and back. I successfully could get one message to either side. 

While sending first message out to xmpp user, a private chat session is
created. Subsequent messages come to private session, and my route is not
invoked when message is received. Looking at the code, this is how chat
session is created, 

chat = chatManager.createChat(getParticipant(), endpoint.getChatId(), new
MessageListener() { 
                public void processMessage(Chat chat, Message message) { 
                    ...... 
                    // not here to do conversation
                     .... 
                        LOG.debug("Received and discarding message from {} :
{}", getParticipant(), message.getBody()); 
               } 

It simply discards the subsequent messages after the chat is created. What I
want is to process all subsequent msgs like the first one was.  It seems
like a code change/route definition change is needed. My routes are like,(I
populate header) 

String fromURL = "xmpp://bot@127.0.0.1:5022?password=bot"; 
from(xmppURL).process(new
marshallProcessor(){}).recipientList(header("destURL")); 

from("jms:topic:clientx").process(new
unmarshallProcessor(){}).recipientList(header("dest")); 

Should I change the fromURL format to stop messages going to chat session? I
tried deleting the chat session anticipating, the message will be put on
route if there is no chat session. But I was wrong. Any help really
appreciated.



--
View this message in context: http://camel.465427.n5.nabble.com/routing-private-chat-xmpp-messages-to-camel-route-tp5729325.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: routing private chat xmpp messages to camel route

Posted by optimist <op...@gmail.com>.
Willem,

Thanks for response.

Can you please post an example where routes are added dynamically? I can try
to use that mechanism to route the private chat messages to my original
route. 

Also, I feel this is not the first instance where private chat messages are
needed to be put on to a camel route. Do you know if xmpp from URI can be
tweaked to get that done?


Thanks.



--
View this message in context: http://camel.465427.n5.nabble.com/routing-private-chat-xmpp-messages-to-camel-route-tp5729325p5729376.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: routing private chat xmpp messages to camel route

Posted by Willem jiang <wi...@gmail.com>.
Hi,

I think you can change you application to be more dynamically.
You should have a control route which accept the request in the public room and if there is a new private chat, you need to create a new route for it.


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Monday, March 18, 2013 at 9:00 AM, optimist wrote:

> I am trying to setup a camel(2.9.5) based bot to move messages from xmpp
> users to JMS and back. I successfully could get one message to either side.  
>  
> While sending first message out to xmpp user, a private chat session is
> created. Subsequent messages come to private session, and my route is not
> invoked when message is received. Looking at the code, this is how chat
> session is created,  
>  
> chat = chatManager.createChat(getParticipant(), endpoint.getChatId(), new
> MessageListener() {  
> public void processMessage(Chat chat, Message message) {  
> ......  
> // not here to do conversation
> ....  
> LOG.debug("Received and discarding message from {} :
> {}", getParticipant(), message.getBody());  
> }  
>  
> It simply discards the subsequent messages after the chat is created. What I
> want is to process all subsequent msgs like the first one was. It seems
> like a code change/route definition change is needed. My routes are like,(I
> populate header)  
>  
> String fromURL = "xmpp://bot@127.0.0.1 (mailto:bot@127.0.0.1):5022?password=bot";  
> from(xmppURL).process(new
> marshallProcessor(){}).recipientList(header("destURL"));  
>  
> from("jms:topic:clientx").process(new
> unmarshallProcessor(){}).recipientList(header("dest"));  
>  
> Should I change the fromURL format to stop messages going to chat session? I
> tried deleting the chat session anticipating, the message will be put on
> route if there is no chat session. But I was wrong. Any help really
> appreciated.
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/routing-private-chat-xmpp-messages-to-camel-route-tp5729325.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).