camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r779124 - in /camel/branches/camel-1.x: ./ components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppConsumer.java
Date Wed, 27 May 2009 11:55:17 GMT
Author: davsclaus
Date: Wed May 27 11:55:16 2009
New Revision: 779124

URL: http://svn.apache.org/viewvc?rev=779124&view=rev
Log:
Merged revisions 779121 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r779121 | davsclaus | 2009-05-27 13:53:02 +0200 (Wed, 27 May 2009) | 1 line
  
  CAMEL-1633: Fixed xmpp consumer to filter packages not needed. Thanks to Edward Campbell
for the patch.
........

Modified:
    camel/branches/camel-1.x/   (props changed)
    camel/branches/camel-1.x/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppConsumer.java

Propchange: camel/branches/camel-1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed May 27 11:55:16 2009
@@ -1 +1 @@
-/camel/trunk:736980,739733,739904,740251,740295,740306,740596,740663,741848,742231,742705,742739,742854,742856,742898,742906,743613,743762,743773,743920,743959-743960,744123,745105,745367,745541,745751,745826,745978,746269,746872,746895,746962,747258,747678-747704,748392,748436,748821,749563-749564,749574,749628-749629,749936,749956,750017,750334,750396,750761,750796,752068,752117,752418,752751-752755,752764-752773,752956,753087,753101,753175,755136,755487,756313,756348,756870,756939,757636,757693,757743,757865,758539,758563,758600,758617,758692,758990,759362,759453,759887,759931,760003,760890,760909,760937,761194,761536,761583,761607,762047,762633,762650,762935,763095,763484,763551,765154,765686,765729,765743,765824,766016,766289,766584,766588,766590,766602,766673,767403,767824,768342,769239,769346,769368,769434,770172,770906,771303,773193,773446,773781,774192,774383,774658-774659,776198,776289,776504,776975,778102,778689-778701
+/camel/trunk:736980,739733,739904,740251,740295,740306,740596,740663,741848,742231,742705,742739,742854,742856,742898,742906,743613,743762,743773,743920,743959-743960,744123,745105,745367,745541,745751,745826,745978,746269,746872,746895,746962,747258,747678-747704,748392,748436,748821,749563-749564,749574,749628-749629,749936,749956,750017,750334,750396,750761,750796,752068,752117,752418,752751-752755,752764-752773,752956,753087,753101,753175,755136,755487,756313,756348,756870,756939,757636,757693,757743,757865,758539,758563,758600,758617,758692,758990,759362,759453,759887,759931,760003,760890,760909,760937,761194,761536,761583,761607,762047,762633,762650,762935,763095,763484,763551,765154,765686,765729,765743,765824,766016,766289,766584,766588,766590,766602,766673,767403,767824,768342,769239,769346,769368,769434,770172,770906,771303,773193,773446,773781,774192,774383,774658-774659,776198,776289,776504,776975,778102,778689-778701,779121

Propchange: camel/branches/camel-1.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-1.x/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppConsumer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppConsumer.java?rev=779124&r1=779123&r2=779124&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppConsumer.java
(original)
+++ camel/branches/camel-1.x/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppConsumer.java
Wed May 27 11:55:16 2009
@@ -25,8 +25,12 @@
 import org.jivesoftware.smack.PacketListener;
 import org.jivesoftware.smack.SmackConfiguration;
 import org.jivesoftware.smack.XMPPConnection;
+import org.jivesoftware.smack.filter.AndFilter;
+import org.jivesoftware.smack.filter.PacketTypeFilter;
+import org.jivesoftware.smack.filter.ToContainsFilter;
 import org.jivesoftware.smack.packet.Message;
 import org.jivesoftware.smack.packet.Packet;
+import org.jivesoftware.smack.packet.Presence;
 import org.jivesoftware.smackx.muc.DiscussionHistory;
 import org.jivesoftware.smackx.muc.MultiUserChat;
 
@@ -65,6 +69,11 @@
             if (LOG.isInfoEnabled()) {
                 LOG.info("Joined room: " + muc.getRoom() + " as: " + endpoint.getNickname());
             }
+
+            // add the presence packet listener to the connection so we only get packets
that concers us
+            final ToContainsFilter toFilter = new ToContainsFilter(endpoint.getParticipant());
+            final AndFilter packetFilter = new AndFilter(new PacketTypeFilter(Presence.class),
toFilter);
+            connection.addPacketListener(this, packetFilter);
         }
 
         super.doStart();
@@ -91,7 +100,7 @@
     }
 
     public void processPacket(Packet packet) {
-        Message message = (Message)packet;
+        Message message = (Message) packet;
 
         if (LOG.isDebugEnabled()) {
             LOG.debug("Recieved XMPP message: " + message.getBody());
@@ -100,13 +109,8 @@
         XmppExchange exchange = endpoint.createExchange(message);
         try {
             getProcessor().process(exchange);
-            if (muc != null) {
-                // must invoke nextMessage to consume the response from the server
-                // otherwise the client local queue will fill up (CAMEL-1467)
-                muc.nextMessage();
-            }
         } catch (Exception e) {
-            LOG.error("Error while processing XMPP message", e);
+            exchange.setException(e);
         }
     }
 



Mime
View raw message