camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chandra Prakash Joshi (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CAMEL-3195) Allow camel to send custom xmpp Presence/PubSub packet to a xmpp endpoint
Date Mon, 28 Feb 2011 05:29:37 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-3195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13000119#comment-13000119
] 

Chandra Prakash Joshi commented on CAMEL-3195:
----------------------------------------------


Below is one discussion that I had with Don Whytock about the design and need for this feature
(The conversation is sorted in ascending order to provide full context)
----


Chandra Prakash Joshi <chandraprakashjoshi at gmail.com>	 Sat, Oct 23, 2010 at 7:42
PM
To: dwhytock at gmail.com
Hi Donald,
 
I have created a patch for CAMEL-3195(new feature). Can you have a look at it? Your comments/Suggestions
are welcome.
 
https://issues.apache.org/activemq/browse/CAMEL-3195
 
Thanks: _Josh
----
Donald Whytock <dwhytock at gmail.com>	 Mon, Oct 25, 2010 at 10:08 PM
To: Chandra Prakash Joshi <chandraprakashjoshi at gmail.com>
Hi Josh,

I saw your comment on the JIRA, and it looked like exactly what I'd
hoped for.  I'm a little snowed under at the moment, but I'll probably
be trying it out this week.

I haven't looked at the component code in detail...Does the XMPP
connection amount to a singleton, with endpoints actually acting as
filters?  As in, if I were to define one endpoint to listen for
presence packets and another to accept incoming chat messages, is that
a single socket connection?

Don

----
chandraprakashjoshi at gmail.com <chandraprakashjoshi at gmail.com>	 Tue, Oct 26, 2010
at 11:50 AM
To: Donald Whytock <dwhytock at gmail.com>
Don,

Thanks for the response and the willingness for trying out the patch. Answer to your question
below:

"Does the XMPP connection amount to a singleton, with endpoints actually acting as filters?"

In code, every "XmppEndpoint" contains a "XMPPConnection" (XmppEndpoint class has XMPPConnection
as private variable, it's not singleton), so every endpoint will open a difference socket
connection to XMPP server.

_Josh

----
Donald Whytock <dwhytock at gmail.com>	 Tue, Oct 26, 2010 at 8:08 PM
To: chandraprakashjoshi at gmail.com
Is that desirable?  I'm sure it's easier, but would it take more
memory and processing to handle two sockets rather than one?  Far as I
know, an XMPP server will send all packets meant for a user to all
connections the user has open, regardless of what machine they're on.
So if two sockets are open, one for messages and one for presence
packets, each socket will get all messages and presence packets.  So
the filtering has to happen on each socket.  If there was a single
socket, the same filtering could be done on a single message rather
than multiple copies.

Again, though, I'm speaking out of ignorance regarding the code.  Is
it a lot more work to do sockets as singletons under Camel?

Don

----
Chandra Prakash Joshi <chandraprakashjoshi at gmail.com>	 Wed, Oct 27, 2010 at 11:46
AM
To: Donald Whytock <dwhytock at gmail.com>
1. "Is that desirable?"

I think it is. I am relying on that design to solve a problem that I recently encountered
in my project.
In my project we are supposed to read messages from a JMS queue and publish them to ejabberd
XMPP server (we will transform the JMS message to PubSub packet).

The issue we are facing is that a pubsub packet delivery takes somewhere between 250-300 milliseconds
(tested it with smack and tsung), so in a serial manner we can consume 3-4 message/sec from
JMS Provider, but our JMS producer will be generating the load of ~50 JMS messages/second
(may become high next year).

The way we solved it right now is to consume messages in parallel, we have 14 threads logging
in to XMPP server, getting messages from a JMS queue and publishing to XMPP topics. and are
able to consume ~50 messages/sec (The xmpp subscribers receive 50 publishes/sec).

Once this enhancement (CAMEL-3195) is available in camel, we plan to have 14 routes, each
reading from:JMS queue endpoint, convert the message to pubsub packet, publish to:xmpp endpoint.


2. Is it a lot more work to do sockets as singletons under Camel?
I suspect it will take long time to make sure we don't break any existing xmpp endpoint use-cases
out there in the field (I mean there might be people who rely on the behavior of "every endpoint
is a new connection"). Also, we need to change the camel-xmpp design to support "connection
per user/resource" rather then "connection per endpoint". If not lot, it's fair amount of
work.

_Josh

----
Donald Whytock <dwhytock at gmail.com>	 Wed, Oct 27, 2010 at 8:21 PM
To: Chandra Prakash Joshi <chandraprakashjoshi at gmail.com>
Interesting.  So while it might be more efficient to consume XMPP on
one thread and delegate after consuming, it's more efficient to
produce XMPP on multiple threads.  And that determination can be made
outside of the endpoint logic.

Simple looks good.

Don

On Wed, Oct 27, 2010 at 2:16 AM, Chandra Prakash Joshi


> Allow camel to send custom xmpp Presence/PubSub packet to a xmpp endpoint
> -------------------------------------------------------------------------
>
>                 Key: CAMEL-3195
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3195
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-xmpp
>            Reporter: Chandra Prakash Joshi
>             Fix For: 2.8.0
>
>         Attachments: Camel-xmpp-pubsub-presence-v2.patch
>
>
> Claus Ibsen suggested that I should create a ticket for this new feature ([http://stackoverflow.com/questions/3645159/can-apache-camel-send-a-xmpp-presence-pubsub-packet-to-an-xmpp-endpoint])
> I need to receive an update published to a JMS topic, convert it to a XMPP packet (Presence
packet or PubSub packet) and route it to an XMPP endpoint.
> I am using ActiveMQ as JMS provider and Apache camel as routing engine. given below is
my route in Camel (to make things simple I read from system.in instead of a jms topic):
> {code:java} 
>      from("stream:in?promptMessage=Enter something:").process( new Processor(){
>         public void process(Exchange exchange) throws Exception {
>                 System.out.println("sending presence with message: " + exchange.getIn().getBody().toString());
>                 Presence p = new Presence(Type.available, exchange.getIn().getBody().toString(),
5, Mode.chat);
>                 exchange.getIn().setBody(p);
>             }
>             }).to("xmpp:user1@banl080161?password=pass1");
> {code}
> Idea is that user1@banl080161 should be able to send a custome presence packet having
status as given from system.in. I am reading from system.in, making a presence packet, setting
this packet in the exchange body and send this presence on behalf of user1@banl080161.
> Problem: nothing gets sent to XMPP server, I use PSI to see packets coming from user1@banl080161,
user1@banl080161 comes online for sure but no custom presence message is received.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message