...
Maven users will need to add the following dependency to their pom.xml for this component:
Code Block |
|
|
<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>
|
URI format
Code Block |
|
|
xmpp://[login@]hostname[:port][/participant][?Options]
|
...
You can append query options to the URI in the following format, ?option=value&option=value&...
Options
Wiki Markup |
{div:class=confluenceTableSmall}
|| Name || Description ||
| {{room}} | 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 {{[email protected]}} and want to join the {{krypton}} room, then the room URL is {{[email protected]}}. Note the {{conference}} part.
It is not a requirement to provide the full room JID. If the {{room}} parameter does not contain the {{@}} symbol, the domain part will be discovered and added by Camel|
| {{user}} | User name (without server name). If not specified, anonymous login will be attempted. |
| {{password}} | Password. |
| {{resource}} | XMPP resource. The default is {{Camel}}. |
| {{createAccount}} | If {{true}}, an attempt to create an account will be made. Default is {{false}}. |
| {{participant}} | JID (Jabber ID) of person to receive messages. {{room}} parameter has precedence over {{participant}}. |
| {{nickname}} | Use nickname when joining room. If room is specified and nickname is not, {{user}} will be used for the nickname. |
| {{serviceName}} | The name of the service you are connecting to. For Google Talk, this would be {{gmail.com}}. |
| {{testConnectionOnStartup}} | *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 {{true}}. |
| {{connectionPollDelay}} | *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 {{10 seconds}}.|
{div}
|
Headers and setting Subject or Language
...
User superman to join room krypton at jabber server with password, secret:
User superman to send messages to joker:
Routing example in Java:
Consumer configuration, which writes all messages from joker into the queue, evil.talk.
Consumer configuration, which listens to room messages:
Room in short notation (no domain part):
Code Block |
|
|
from("xmpp://[email protected]/?password=secret&room=krypton").
to("activemq:krypton.talk");
|
When connecting to the Google Chat service, you'll need to specify the serviceName as well as your credentials:
Wiki Markup |
{snippet:id=e1|lang=java|url="">
|
Code Block |
|
|
from("direct:start").
to("xmpp://talk.google.com:5222/[email protected]?serviceName=gmail.com&user=fromuser&password=secret").
to("mock:result");
|
Include Page |
|
|