이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 139. XMPP


XMPP Component

The xmpp: component implements an XMPP (Jabber) transport.

URI format

xmpp://[login@]hostname[:port][/participant][?Options]
Copy to Clipboard Toggle word wrap
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.
You can append query options to the URI in the following format, ?option=value&option=value&...

Options

Expand
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 superman@jabber.org and want to join the krypton room, then the room URL is krypton@conference.jabber.org. Note the conference part.
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.

Headers and setting Subject or Language

Apache 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.

Examples

User superman to join room krypton at jabber server with password, secret:
xmpp://superman@jabber.org/?room=krypton@conference.jabber.org&password=secret
Copy to Clipboard Toggle word wrap
User superman to send messages to joker:
xmpp://superman@jabber.org/joker@jabber.org?password=secret
Copy to Clipboard Toggle word wrap
Routing example in Java:
from("timer://kickoff?period=10000").
setBody(constant("I will win!\n Your Superman.")).
to("xmpp://superman@jabber.org/joker@jabber.org?password=secret");
Copy to Clipboard Toggle word wrap
Consumer configuration, which writes all messages from joker into the queue, evil.talk.
from("xmpp://superman@jabber.org/joker@jabber.org?password=secret").
to("activemq:evil.talk");
Copy to Clipboard Toggle word wrap
Consumer configuration, which listens to room messages:
from("xmpp://superman@jabber.org/?password=secret&room=krypton@conference.jabber.org").
to("activemq:krypton.talk");
Copy to Clipboard Toggle word wrap
Room in short notation (no domain part):
from("xmpp://superman@jabber.org/?password=secret&room=krypton").
to("activemq:krypton.talk");
Copy to Clipboard Toggle word wrap
When connecting to the Google Chat service, you'll need to specify the serviceName as well as your credentials:
// send a message from fromuser@gmail.com to touser@gmail.com
from("direct:start").
        to("xmpp://talk.google.com:5222/touser@gmail.com?serviceName=gmail.com&user=fromuser&password=secret").
        to("mock:result");
Copy to Clipboard Toggle word wrap
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat