Hi


On Mon, Aug 17, 2009 at 1:23 PM, Ely Celino<[email protected]> wrote:
> Ok, got it! Thanks. I think this is what I exactly need!
>
> If it is ok with you, I want to ask a few more questions.
>
> I am having problem receiving the message in my RouteBuilder. My broker is
> running using the following code
>
>  public void start() throws Exception {
>        BrokerService broker = new BrokerService();
>        broker.setDedicatedTaskRunner(false);
>        TransportConnector xmppTransport = new TransportConnector();
>        xmppTransport.setName("xmpp");
>        xmppTransport.setUri(new URI("xmpp://localhost:61222"));
>        broker.addConnector(xmppTransport);
>        broker.setPlugins(new BrokerPlugin[]{new
> PlayerAuthenticationPlugin()});
>        broker.start();
>
>    }
>
> Then I want to process the xmpp messages/packets, but I am not receiving
> anything yet. this is my code:
>
> CamelContext context = new DefaultCamelContext();
>        ConnectionFactory connectionFactory = new
> ActiveMQConnectionFactory("xmpp://localhost:61222");
>        // Note we can explicity name the component
>        context.addComponent("xmpp",
> JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
>        RouteBuilder routeBuilder = new RouteBuilder() {
>           �...@override
>            public void configure() throws Exception {
>                from("xmpp://localhost:61222/").process(new Processor() {
>                   �...@override
>                    public void process(Exchange exchange) throws Exception
> {
>                        System.out.println("this is it!");
>                        Map map = exchange.getIn().getHeaders();
>                        Set keys = map.keySet();
>                        for (Object key : keys) {
>                            System.out.println(key + ":" + map.get(key));
>                        }
>                        System.out.println("received: " +
> exchange.getIn().getBody());
>
>                    }
>                });
>            }
>        };
>        try {
>            context.addRoutes(routeBuilder);
>        } catch (Exception e1) {
>            // TODO Auto-generated catch block
>            e1.printStackTrace();
>        }
>
>        try {
>            context.start();
>        } catch (Exception e) {
>            e.printStackTrace();
>        }
>
> Nothing prints when running these codes.
> Am I doing it right? Or I am missing something here...?

No what you are doing is creating an ActiveMQ connection that is for
AMQ messaging.

What you need to do is using camel-xmpp instead. Camel can auto create
all that so basically just do in the route builder

from("mpp://localhost:61222/").process ....






>
> On Mon, Aug 17, 2009 at 7:06 PM, Claus Ibsen <[email protected]> wrote:
>
>> On Mon, Aug 17, 2009 at 12:59 PM, ELY<[email protected]> wrote:
>> >
>> > Wow! That was quick. Thanks man, didn't know how generous camel-users
>> are.
>> >
>> > What I really want to do is more on the server side. I wonder if there's
>> a
>> > lower level way of processing stanzas such as IQ, Message and Presence. I
>> am
>> > thinking of overriding methods.
>> >
>>
>> Camel uses the Smack API under the belt so whatever you can do with
>> that you should be able to do in Camel.
>>
>> You can get hold of it the Smack Message from
>> MmpMessage xmppMessage = (XmpMessage) exchange.getIn();
>>
>> Message smackMessage = xmpMessage.getMessage();
>>
>>
>> >
>> > Claus Ibsen-2 wrote:
>> >>
>> >> Hi
>> >>
>> >> Welcome to the Camel ride.
>> >>
>> >> Yes Camel have a XMPP component
>> >> http://camel.apache.org/xmpp
>> >>
>> >> There are some basic examples/snippet on that page.
>> >>
>> >>
>> >> And someone tested it with Groovy and wrote a little blog how to talk to
>> >> gtalk
>> >>
>> http://www.andrejkoelewijn.com/wp/2009/02/28/groovy-and-grape-easiest-way-to-send-gtalk-message-with-apache-camel/
>> >>
>> >> Its the same for regular Java.
>> >>
>> >>
>> >> On Mon, Aug 17, 2009 at 11:47 AM, ELY<[email protected]> wrote:
>> >>>
>> >>> Right now I already have a server application running with an embedded
>> >>> ActiveMQ Broker. This application uses my self-made DB for users and
>> >>> rooms.
>> >>> This server communicates well with clients using JMS.
>> >>>
>> >>> Now, for interoperability and standardisation, I want to use XMPP for
>> >>> communication. I believe this can be done with ActiveMQ and Camel. Does
>> >>> anybody knows how? Please help.
>> >>>
>> >>> Thanks.
>> >>> --
>> >>> View this message in context:
>> >>> http://www.nabble.com/ActiveMQ%2BCamel%2BXMPP-tp25003969p25003969.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/ActiveMQ%2BCamel%2BXMPP-tp25003969p25004727.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
>>
>



-- 
Claus Ibsen
Apache Camel Committer

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

Reply via email to