You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Sameer Nambiar <sa...@nambiar.net> on 2009/06/15 14:30:51 UTC

Unable to simultaneously send and receive via an XMPP endpoint.

Hi,

I am looking to use Camel's XMPP endpoint for application to application
communication. The following environment has been configured:

* Openfire 3.6.4
* Camel 2.0-M1
* Smack 3.1.0

I am a newbie to Camel. While I have been able to use the XMPP endpoint to
either send or receive to another user on the openfire/xmpp server, I am not
able to use the endpoint for simultaneous send and receive communication.

Routes have been configured as:
		camel.addRoutes(new RouteBuilder() {		
			public void configure() throws Exception {
		
				XmppEndpoint endpoint = new XmppEndpoint(); 
				endpoint.setCamelContext(camel);
				endpoint.setHost("127.0.0.1");
				endpoint.setPort(5222);
				endpoint.setUser("camel");
				endpoint.setPassword("camel");
				endpoint.setParticipant("admin@127.0.0.1");
				camel.addEndpoint("xmppserver", endpoint); 
		
		    	from("xmppserver").to("log:out?level=INFO");
		    	from("direct:toAdmin").to("xmppserver");
			}
		});

I use the ProducerTemplate to send a message as:
template.sendBody("direct:toAdmin", "From template to admin...." +
System.currentTimeMillis());

If I comment out one of the routes above, the communication is flawless.
When I have both the routes configured the outbound/send (toAdmin) works, 
but I am not able to receive messages.

Analyzing this one step at a time, I found that initially I can receive the
messages. But, after I send out the first message via the endpoint,
subsequent receiving does not work.

I am thinking of using this one-endpoint (xmpp) to send to and receive from
the peer application. Should I be configuring my routes differently?

Would greatly appreciate any leads on this regard.

Thanks,
Sameer.
-- 
View this message in context: http://www.nabble.com/Unable-to-simultaneously-send-and-receive-via-an-XMPP-endpoint.-tp24033774p24033774.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Unable to simultaneously send and receive via an XMPP endpoint.

Posted by Sameer Nambiar <sa...@nambiar.net>.
Thank you for the feedback, Claus.

There is a ticket recently added to JIRA about something with
listeners in the smack library.

I presume you are referring to CAMEL-1633 (and 1698). This does seem related
to the issue I am facing. I will try the fix from trunk and post a feedback.

Could you try to not use the same endpoint for both consumer and producer.

Yes, I did try this as a workaround and it does work. Using this workaround
may eventually result in some overhead in ensuring both connections to be
active for the communication channel to be "up". It is good enough for me to
move forward at this stage.

Thanks,
Sameer.





Claus Ibsen-2 wrote:
> 
> On Mon, Jun 15, 2009 at 2:30 PM, Sameer Nambiar<sa...@nambiar.net> wrote:
>>
>> Hi,
>>
>> I am looking to use Camel's XMPP endpoint for application to application
>> communication. The following environment has been configured:
>>
>> * Openfire 3.6.4
>> * Camel 2.0-M1
>> * Smack 3.1.0
>>
>> I am a newbie to Camel. While I have been able to use the XMPP endpoint
>> to
>> either send or receive to another user on the openfire/xmpp server, I am
>> not
>> able to use the endpoint for simultaneous send and receive communication.
>>
>> Routes have been configured as:
>>                camel.addRoutes(new RouteBuilder() {
>>                        public void configure() throws Exception {
>>
>>                                XmppEndpoint endpoint = new
>> XmppEndpoint();
>>                                endpoint.setCamelContext(camel);
>>                                endpoint.setHost("127.0.0.1");
>>                                endpoint.setPort(5222);
>>                                endpoint.setUser("camel");
>>                                endpoint.setPassword("camel");
>>                              
>>  endpoint.setParticipant("admin@127.0.0.1");
>>                                camel.addEndpoint("xmppserver", endpoint);
>>
>>                        from("xmppserver").to("log:out?level=INFO");
>>                        from("direct:toAdmin").to("xmppserver");
>>                        }
>>                });
>>
>> I use the ProducerTemplate to send a message as:
>> template.sendBody("direct:toAdmin", "From template to admin...." +
>> System.currentTimeMillis());
>>
>> If I comment out one of the routes above, the communication is flawless.
>> When I have both the routes configured the outbound/send (toAdmin) works,
>> but I am not able to receive messages.
>>
>> Analyzing this one step at a time, I found that initially I can receive
>> the
>> messages. But, after I send out the first message via the endpoint,
>> subsequent receiving does not work.
>>
>> I am thinking of using this one-endpoint (xmpp) to send to and receive
>> from
>> the peer application. Should I be configuring my routes differently?
>>
>> Would greatly appreciate any leads on this regard.
> Hi
> 
> There is a ticket recently added to JIRA about something with
> listeners in the smack library.
> Anyway just wanted to let you know that there could be an issue in there.
> 
> Could you try to not use the same endpoint for both consumer and producer.
> Eg in your confiugure method create the XmppEndpoint 2 times. And use
> a different one for the consumer and the producer.
> So you do not reuse the same endpoint.
> 
> 
>>
>> Thanks,
>> Sameer.
>> --
>> View this message in context:
>> http://www.nabble.com/Unable-to-simultaneously-send-and-receive-via-an-XMPP-endpoint.-tp24033774p24033774.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://www.nabble.com/Unable-to-simultaneously-send-and-receive-via-an-XMPP-endpoint.-tp24033774p24047380.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Unable to simultaneously send and receive via an XMPP endpoint.

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Jun 15, 2009 at 2:30 PM, Sameer Nambiar<sa...@nambiar.net> wrote:
>
> Hi,
>
> I am looking to use Camel's XMPP endpoint for application to application
> communication. The following environment has been configured:
>
> * Openfire 3.6.4
> * Camel 2.0-M1
> * Smack 3.1.0
>
> I am a newbie to Camel. While I have been able to use the XMPP endpoint to
> either send or receive to another user on the openfire/xmpp server, I am not
> able to use the endpoint for simultaneous send and receive communication.
>
> Routes have been configured as:
>                camel.addRoutes(new RouteBuilder() {
>                        public void configure() throws Exception {
>
>                                XmppEndpoint endpoint = new XmppEndpoint();
>                                endpoint.setCamelContext(camel);
>                                endpoint.setHost("127.0.0.1");
>                                endpoint.setPort(5222);
>                                endpoint.setUser("camel");
>                                endpoint.setPassword("camel");
>                                endpoint.setParticipant("admin@127.0.0.1");
>                                camel.addEndpoint("xmppserver", endpoint);
>
>                        from("xmppserver").to("log:out?level=INFO");
>                        from("direct:toAdmin").to("xmppserver");
>                        }
>                });
>
> I use the ProducerTemplate to send a message as:
> template.sendBody("direct:toAdmin", "From template to admin...." +
> System.currentTimeMillis());
>
> If I comment out one of the routes above, the communication is flawless.
> When I have both the routes configured the outbound/send (toAdmin) works,
> but I am not able to receive messages.
>
> Analyzing this one step at a time, I found that initially I can receive the
> messages. But, after I send out the first message via the endpoint,
> subsequent receiving does not work.
>
> I am thinking of using this one-endpoint (xmpp) to send to and receive from
> the peer application. Should I be configuring my routes differently?
>
> Would greatly appreciate any leads on this regard.
Hi

There is a ticket recently added to JIRA about something with
listeners in the smack library.
Anyway just wanted to let you know that there could be an issue in there.

Could you try to not use the same endpoint for both consumer and producer.
Eg in your confiugure method create the XmppEndpoint 2 times. And use
a different one for the consumer and the producer.
So you do not reuse the same endpoint.


>
> Thanks,
> Sameer.
> --
> View this message in context: http://www.nabble.com/Unable-to-simultaneously-send-and-receive-via-an-XMPP-endpoint.-tp24033774p24033774.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus