WARNING: This server provides a static reference view of the NetKernel documentation. Links to dynamic content do not work. For the best experience we recommend you install NetKernel and view the documentation in the live system .


Description:Jabber XMPP symmetric peer transport/accessor
Category:accessor prototype

JabberEndpoint is an accessor that must be instantiated from a prototype. You must instantiate the prototype in your module to create an accessor that can receive requests.


The JabberEndpoint prototype has the following initialisation parameters:

configMandatoryIdentifier or XML(none)
XML configuration resource
An identifier for created logical endpoint, if omitted a unique auto-generated value it will be used.
If included this parameter will mark the endpoint as private and it will not be exposed outside module.

Here is an auto-generated example of how to instantiate an instance of JabberEndpoint:

  <config>XML configuration resource</config>
Import Requirements

To use JabberEndpoint accessor prototype you must import the module urn:org:netkernel:mod:jabber:


JabberEndpoint is a symmetric XMPP peer. It implements both a NetKernel transport to receive messages and and accessor to send messages. When configured it will listen for messages from a XMPP server and can also initiate conversations by sending messages. As a peer-to-peer endpoint, receiving and sending messages may occur completely independently.


The JabberEndpoint must be provided with a config parameter. This has the form...

  < !-- enable both server and client -->

  • tls encrypted connection mode is optional.
  • port is optional and will default to 5222
  • enabled is optional and will default to true

Receiving Messages

When the endpoint is commissioned it will listen for messages for the configured user@server identity. When a message is received the endpoint issues a SOURCE request into the host address space. The request has the following form...

Resource Identifier Syntax

+ to @ [ configured user identity ]
+ from @ [ sender's identity ]
+ message @ [ the received message ]

The message argument is of type org.jivesoftware.smack.packet.Message

A handler of the jabber:message request may source the message argument and call getBody() to receive the message body as a String.

Replying to a received message

When the JabberEndpoint issues a jabber:message request into the host address space it also dynamically constructs a transient space which implements the resource jabber:reply. The transient space is inserted into the request scope superstack and is accessible in the context of the message request.

A message handler can reply directly to the sender of the message by SINK ing either a java.lang.String or org.jivesoftware.smack.packet.Message to jabber:reply

For example:

context.sink("jabber:reply", "Message received - thanks very much");

Sending Messages

The JabberEndpoint implements the active:jabberSend accessor with syntax...

Resource Identifier Syntax

+ to @ [ recipients identity ]
+ message @ [ the message to send ]

Message may be either java.lang.String or org.jivesoftware.smack.packet.Message

Note: the JabberEndpoint must be instantiated and connected to the XMPP server for it to be able to send messages.



The following code fragment shows how to send a message...

//Send a message with active:jabberSend
req.addArgument("to", "someone@jabber.org");
req.addArgumentByValue("message", "Hello XMPP World");


The following mapper endpoint declaration shows how you might use the mapper to route received messages to a handler script...

          <argument name="to" />
          <argument name="from" />
          <argument name="message" />
        <argument name="operator">res:/myJabberMessageHandler.gy</argument>
        <argument name="to">arg:to</argument>
        <argument name="from">arg:from</argument>
        <argument name="message">arg:message</argument>
  <space>....space containing script and groovy runtime import....</space>