Stan If possible please also submit a patch for checking that username and/or password is given. So we can avoid the NPE and write a suitable error message.
Camel have a ObjectHelper.notEmpty / notNull that can check for this. On Tue, Aug 18, 2009 at 4:34 AM, Stan Lewis<[email protected]> wrote: > Are you specifying a username/password for the XMPP component? I > believe you also need to specify the participant which is the Jabber > ID that you'll receive messages from. > > There's also an issue where the XMPP consumer stops listening, I've > got a patch submitted for this for CAMEL-1914. > > On Mon, Aug 17, 2009 at 10:15 PM, Ely Celino<[email protected]> wrote: >> Still no luck for me. My code is: >> >> from("xmpp://localhost:61222").process(new Processor() { >> �...@override >> public void process(Exchange exchange) throws Exception >> { >> XmppMessage m = (XmppMessage) exchange.getIn(); >> org.jivesoftware.smack.packet.Message xmppMessge = >> m.getXmppMessage(); >> System.out.println("XML" + xmppMessge.toXML()); >> } >> }); >> >> and I am getting the following error when calling context.start(): >> >> java.lang.NullPointerException: null keys not allowed >> at >> org.jivesoftware.smack.util.collections.AbstractReferenceMap.put(AbstractReferenceMap.java:249) >> at org.jivesoftware.smack.ChatManager.createChat(ChatManager.java:163) >> at org.jivesoftware.smack.ChatManager.createChat(ChatManager.java:155) >> at org.jivesoftware.smack.ChatManager.createChat(ChatManager.java:136) >> at >> org.apache.camel.component.xmpp.XmppConsumer.doStart(XmppConsumer.java:54) >> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:47) >> at >> org.apache.camel.impl.DefaultCamelContext.addService(DefaultCamelContext.java:421) >> at >> org.apache.camel.impl.DefaultCamelContext.startRoutes(DefaultCamelContext.java:659) >> at >> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:632) >> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:47) >> at Main.main(Main.java:18) >> >> >> >> On Mon, Aug 17, 2009 at 7:35 PM, Claus Ibsen <[email protected]> wrote: >> >>> 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 >>> >> > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
