The xmpp: component implements an XMPP (Jabber) transport.
Maven users will need to add the following dependency to their
pom.xml for this component:
<dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-xmpp</artifactId> <version>x.x.x</version> <!-- use the same version as your Camel core version --> </dependency>
The component supports both room based and private person-person conversations.
The component supports both producer and consumer (you can get messages from XMPP or send messages to XMPP). Consumer mode supports rooms starting.
You can append query options to the URI in the following format,
If this option is specified, the component will connect to MUC (Multi User Chat). Usually, the domain name for MUC is different from the login domain. For example, if you are
User name (without server name). If not specified, anonymous login will be attempted.
XMPP resource. The default is
JID (Jabber ID) of person to receive messages.
Use nickname when joining room. If room is specified and nickname is not,
The name of the service you are connecting to. For Google Talk, this would be
Camel 2.11 Specifies whether to test the connection on startup. This is used to ensure that the XMPP client has a valid connection to the XMPP server when the route starts. Camel throws an exception on startup if a connection cannot be established. When this option is set to false, Camel will attempt to establish a "lazy" connection when needed by a producer, and will poll for a consumer connection until the connection is established. Default is
Camel 2.11 The amount of time in seconds between polls to verify the health of the XMPP connection, or between attempts to establish an initial consumer connection. Camel will try to re-establish a connection if it has become inactive. Default is
|pubsub||Camel 2.15 Accept pubsub packets on input, default is false|
|doc||Camel 2.15 Set a doc header on the IN message containing a Document form of the incoming packet; default is true if presence or pubsub are true, otherwise false|
|connectionConfiguration||Camel 2.18: To use an existing connection configuration|
Camel sets the message IN headers as properties on the XMPP message. You can configure a
HeaderFilterStategy if you need custom filtering of headers.
The Subject and Language of the XMPP message are also set if they are provided as IN headers.
superman to join room
jabber server with password,
superman to send messages to
Routing example in Java:
from("timer://kickoff?period=10000"). setBody(constant("I will win!\n Your Superman.")). to("xmpp://email@example.comfirstname.lastname@example.org?password=secret");
Consumer configuration, which writes all messages from
joker into the queue,
Consumer configuration, which listens to room messages:
Room in short notation (no domain part):
When connecting to the Google Chat service, you'll need to specify the
serviceName as well as your credentials:
from("direct:start"). to("xmpp://talk.google.com:email@example.com?serviceName=gmail.com&user=fromuser&password=secret"). to("mock:result");