Contact Us 1-800-596-4880

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

Feature Value Description

Transport

XMPP

The name/protocol of the transport

Doc

Links to the JavaDoc and SchemaDoc for the transport

Inbound

check

Whether the transport can receive inbound events and can be used for an inbound endpoint.

Outbound

check

Whether the transport can produce outbound events and be used with an outbound endpoint.

Request

check

Whether this endpoint can be queried directly with a request call (via MuleClient or the EventContext)

Transactions

error

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

error

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.

Retries

error

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

one-way, request-response

Message Exchange Patterns supported by this transport.

Default MEP

one-way

The default MEP for endpoints that use this transport that do not explicitly configure a MEP.

Maven Artifact

org.mule.transport:mule-transport-xmpp

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/current/mule-xmpp.xsd

Endpoint syntax:

  1. Raw URLs:

    xmpp://MESSAGE/theUser@jabber.server.com
    xmpp://CHAT/theUser@jabber.server.com
    xmpp://GROUPCHAT/theGroupChat
  2. 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 org.mule.transport.xmpp.filters 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/current/mule.xsd
      http://www.mulesoft.org/schema/mule/xmpp http://www.mulesoft.org/schema/mule/xmpp/current/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/current/mule.xsd
        http://www.mulesoft.org/schema/mule/xmpp http://www.mulesoft.org/schema/mule/xmpp/current/mule-xmpp.xsd
        http://www.mulesoft.org/schema/mule/stdio http://www.mulesoft.org/schema/mule/stdio/current/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>

Configuration Reference

XMPP Transport

The XMPP transport connects Mule to an XMPP (Jabber) server.

Connector

Connect Mule to an XMPP (Jabber) server to send or receive data via the network.

Attributes of <connector…​>

Name Description

host

Host name or IP address of the Jabber server.

Type: string
Required: no
Default: none

port

The port number to connect on. Default port is 5222.

Type: port number
Required: no
Default: none

serviceName

The service name to use when connecting the Jabber server.

user

The username used for authentication.

Type: string
Required: no
Default: none

password

The password for the user being authenticated.

Type: string
Required: no
Default: none

resource

The resource portion of the address, such as user@host/resource or domain/resource.

Type: string
Required: no
Default: none

createAccount

If true, an attempt is made to create an account using the user and password while connecting. Default is false.

Type: boolean
Required: no
Default: false

No Child Elements of <connector…​>

Inbound Endpoint

The endpoint on which this connector receives messages from the xmpp connection.

Attributes of <inbound-endpoint…​>

Name Description

recipient

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.

Type: string
Required: no
Default: none

from

The user who sent the message. Ignored in GROUPCHAT type endpoints.

Type: string
Required: no
Default: none

type

The type of the Jabber message to send: MESSAGE, CHAT or GROUPCHAT.

Type: enumeration
Required: no
Default: CHAT

subject

The subject of the message (applies to type=MESSAGE endpoints only).

Type: string
Required: no
Default: none

thread

The thread to which the message belongs.

Type: string
Required: no
Default: none

nickname

The user’s nickname in a groupchat.

Type: string
Required: no
Default: none

No Child Elements of <inbound-endpoint…​>

Outbound Endpoint

The endpoint to which this connector sends messages.

Attributes of <outbound-endpoint…​>

Name Description

recipient

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.

Type: string
Required: no
Default: none

from

The user who sent the message. Ignored in GROUPCHAT type endpoints.

Type: string
Required: no
Default: none

type

The type of the Jabber message to send: MESSAGE, CHAT or GROUPCHAT.

Type: enumeration
Required: no
Default: CHAT

subject

The subject of the message (applies to type=MESSAGE endpoints only).

Type: string
Required: no
Default: none

thread

The thread to which the message belongs.

Type: string
Required: no
Default: none

nickname

The user’s nickname in a groupchat.

Type: string
Required: no
Default: none

No Child Elements of <outbound-endpoint…​>

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 Description

recipient

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.

Type: string
Required: no
Default: none

from

The user who sent the message. Ignored in GROUPCHAT type endpoints.

Type: string
Required: no
Default: none

type

The type of the Jabber message to send: MESSAGE, CHAT or GROUPCHAT.

Type: enumeration
Required: no
Default: CHAT

subject

The subject of the message (applies to type=MESSAGE endpoints only).

Type: string
Required: no
Default: none

thread

The thread to which the message belongs.

Type: string
Required: no
Default: none

nickname

The user’s nickname in a groupchat.

Type: string
Required: no
Default: none

No Child Elements of <endpoint…​>

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.

JavaDoc API Reference

The JavaDoc for this module can be found below:

Maven

This transport is part of the following maven module:

<dependency>
  <groupId>org.mule.transports</groupId>
  <artifactId>mule-transport-xmpp</artifactId>
  <version>3.7.0</version>
</dependency>

Best Practices

Put your login credentials in a properties file, not hard-coded in the configuration. This also allows you to use different settings between development, test and production systems.

Notes

The current implementation of the transport is limited to one-way endpoints only. The logic that supports request-response endpoints is currently not implemented.