Legend
XMPP Transport Reference
Mule Runtime Engine versions 3.5, 3.6, and 3.7 reached End of Life on or before January 25, 2020. For more information, contact your Customer Success Manager to determine how you can migrate to the latest Mule version. |
The XMPP transport receives and sends Mule messages over the Extensible Messaging and Presence Protocol (XMPP), which is also known as Jabber.
Transport Info
Transport | Doc | Inbound | Outbound | Request | Transactions | Streaming | Retries | MEPs | Default MEP | Maven Artifact |
---|---|---|---|---|---|---|---|---|---|---|
XMPP |
one-way, request-response |
one-way |
org.mule.transport:mule-transport-xmpp |
Transport - The name/protocol of the transport
Docs - Links to the JavaDoc and SchemaDoc for the transport
Inbound - Whether the transport can receive inbound events and can be used for an inbound endpoint
Outbound - Whether the transport can produce outbound events and be used with an outbound endpoint
Request - Whether this endpoint can be queried directly with a request call (via MuleClient or the EventContext)
Transactions - Whether transactions are supported by the transport. Transports that support transactions can be configured in either local or distributed two-phase commit (XA) transaction.
Streaming - Whether this transport can process messages that come in on an input stream. This allows for very efficient processing of large data. For more information, see Streaming.
Retry - Whether this transport supports retry policies. Note that all transports can be configured with Retry policies, but only the ones marked here are officially supported by MuleSoft
MEPs - Message Exchange Patterns supported by this transport
Default MEP - The default MEP for endpoints that use this transport that do not explicitly configure a MEP
Maven Artifact - The group name a artifact name for this transport in Maven
Namespace and Syntax
XML namespace:
http://www.mulesoft.org/schema/mule/xmpp
XML schema location:
http://www.mulesoft.org/schema/mule/xmpp/3.6/mule-xmpp.xsd
Endpoint syntax:
-
Raw URLs:
xmpp://MESSAGE/theUser@jabber.server.com xmpp://CHAT/theUser@jabber.server.com xmpp://GROUPCHAT/theGroupChat
-
Transport-specific endpoints in XML:
<xmpp:inbound-endpoint type="MESSAGE" from="theUser@jabber.server.com"/> <xmpp:outbound-endpoint type="MESSAGE" recipient="theUser@jabber.server.com"/> <xmpp:inbound-endpoint type="CHAT" from="theUser@jabber.server.com"/> <xmpp:outbound-endpoint type="CHAT" recipient="theUser@jabber.server.com"/> <xmpp:inbound-endpoint type="GROUPCHAT" from="theGroupChat" nickname="muley"/> <xmpp:outbound-endpoint type="GROUPCHAT" recipient="theGroupChat" nickname="muley"/>
Connector and endpoint syntax:
<xmpp:connector name="xmpp" host="localhost" user="theUser" password="secret"/>
Filters
There are several filters in the
package that filter XMPP messages. AbstractXmppFilter
is an abstract filter adapter that allows Smack filters to be configured as Mule filters.
The following filter classes extend the abstract filter:
-
XmppAndFilter
-
XmppFromContainsFilter
-
XmppMessageTypeFilter
-
XmppNotFilter
-
XmppOrFilter
-
XmppPacketIDFilter
-
XmppPacketTypeFilter
-
XmppThreadFilter
-
XmppToContainsFilter
Features
-
Send and receive messages to/from an individual Jabber user
-
Send and receive messages to/from a Jabber one-on-one chat
-
Send and receive messages to/from a Jabber multi-user chat
Usage
The configuration of a connector is mandatory as it identifies the Jabber server to connect to. Thus, all information to establish the connection such as the host to contact and the user credentials to use are configured here.
Configuration options on an endpoint include the type (whether it’s a chat, a message or a groupchat) and the Jabber ID the endpoint is talking to.
The XMPP transport does not support transactions as the XMPP protocol is not transactional.
Example Configurations
Receive Messages in a Flow
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xmpp="http://www.mulesoft.org/schema/mule/xmpp"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.6/mule.xsd
http://www.mulesoft.org/schema/mule/xmpp http://www.mulesoft.org/schema/mule/xmpp/3.6/mule-xmpp.xsd">
<xmpp:connector name="xmppConnector" host="localhost" user="theUser" password="secret"/>
<flow name="receiveMessage">
<xmpp:inbound-endpoint type="MESSAGE" from="other@jabber.server.com"/>
<component class="com.mycompany.mule.JabberMessageHandler"/>
</flow>
</mule>
Simple Jabber Chat Client
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xmpp="http://www.mulesoft.org/schema/mule/xmpp"
xmlns:stdio="http://www.mulesoft.org/schema/mule/stdio"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.6/mule.xsd
http://www.mulesoft.org/schema/mule/xmpp http://www.mulesoft.org/schema/mule/xmpp/3.6/mule-xmpp.xsd
http://www.mulesoft.org/schema/mule/stdio http://www.mulesoft.org/schema/mule/stdio/3.6/mule-stdio.xsd">
<xmpp:connector name="xmppConnector" host="localhost" user="theUser" password="secret"/>
<flow name="stdio2xmpp">
<stdio:inbound-endpoint system="IN"/>
<xmpp:outbound-endpoint type="CHAT" recipient="otheruser@localhost"/>
</flow>
<flow name="xmpp2stdio">
<xmpp:inbound-endpoint type="CHAT" from="otheruser@localhost"/>
<xmpp:xmpp-to-object-transformer/>
<stdio:outbound-endpoint system="OUT"/>
</flow>
</mule>
Note: In this code example, spring-beans-current.xsd
is a placeholder. To locate the correct version, see http://www.springframework.org/schema/beans/.
Connector
Connect Mule to an XMPP (Jabber) server to send or receive data via the network.
Attributes of <connector…>
Name | Type | Required | Default | Description |
---|---|---|---|---|
host |
string |
no |
Host name or IP address of the Jabber server. |
|
port |
port number |
no |
The port number to connect on. Default port is 5222. |
|
serviceName |
string |
no |
The service name to use when connecting the Jabber server. |
|
user |
string |
no |
The username used for authenitcation. |
|
password |
string |
no |
The password for the user being authenticated. |
|
resource |
string |
no |
The resource portion of the address, such as user@host/resource or domain/resource. |
|
createAccount |
boolean |
no |
If true, an attempt is made to create an account using the user and password while connecting. Default is false. |
Inbound endpoint
The endpoint on which this connector receives messages from the xmpp connection.
Attributes of <inbound-endpoint…>
Name | Type | Required | Default | Description |
---|---|---|---|---|
recipient |
string |
no |
The Jabber ID of the intended recipient of the messages, such as ross@myco.com. For GROUPCHAT type endpoints, this is the address of the chat to join. |
|
from |
string |
no |
The user who sent the message. Ignored in GROUPCHAT type endpoints. |
|
type |
enumeration |
no |
CHAT |
The type of the Jabber message to send: MESSAGE, CHAT or GROUPCHAT. |
subject |
string |
no |
The subject of the message (applies to type=MESSAGE endpoints only). |
|
thread |
string |
no |
The thread to which the message belongs. |
|
nickname |
string |
no |
The user’s nickname in a groupchat. |
Outbound endpoint
The endpoint to which this connector sends messages.
Attributes of <outbound-endpoint…>
Name | Type | Required | Default | Description |
---|---|---|---|---|
recipient |
string |
no |
The Jabber ID of the intended recipient of the messages, such as ross@myco.com. For GROUPCHAT type endpoints, this is the address of the chat to join. |
|
from |
string |
no |
The user who sent the message. Ignored in GROUPCHAT type endpoints. |
|
type |
enumeration |
no |
CHAT |
The type of the Jabber message to send: MESSAGE, CHAT or GROUPCHAT. |
subject |
string |
no |
The subject of the message (applies to type=MESSAGE endpoints only). |
|
thread |
string |
no |
The thread to which the message belongs. |
|
nickname |
string |
no |
The user’s nickname in a groupchat. |
Endpoint
An endpoint "template" that can be used to construct an inbound or outbound endpoint elsewhere in the configuration by referencing the endpoint name.
Attributes of <endpoint…>
Name | Type | Required | Default | Description |
---|---|---|---|---|
recipient |
string |
no |
The Jabber ID of the intended recipient of the messages, such as ross@myco.com. For GROUPCHAT type endpoints, this is the address of the chat to join. |
|
from |
string |
no |
The user who sent the message. Ignored in GROUPCHAT type endpoints. |
|
type |
enumeration |
no |
CHAT |
The type of the Jabber message to send: MESSAGE, CHAT or GROUPCHAT. |
subject |
string |
no |
The subject of the message (applies to type=MESSAGE endpoints only). |
|
thread |
string |
no |
The thread to which the message belongs. |
|
nickname |
string |
no |
The user’s nickname in a groupchat. |
Transformers
These are transformers specific to this transport. Note that these are added automatically to the Mule registry at start up. When doing automatic transformations these will be included when searching for the correct transformers.
Name | Description |
---|---|
xmpp-to-object-transformer |
The xmpp-to-object-transformer element configures a transformer that converts an XMPP message into an object by extracting the message payload. |
object-to-xmpp-transformer |
The object-to-xmpp-transformer element configures a transformer that converts an object into an XMPP message. |
Schema
Complete schema reference documentation.
Maven
This transport is part of the following maven module:
<dependency>
<groupId>org.mule.transports</groupId>
<artifactId>mule-transport-xmpp</artifactId>
<version>3.6.0</version>
</dependency>