Skip to content

rkoshy/mule-transport-zeromq

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mule ZeroMQ Transport - User Guide

Configuration Reference

Connector Properties

NameTypeRequiredDefaultDescription
namestringyes

The connector's name. Used to reference a connector from an endpoint.

io-threadsintegerno1

Specifies the size of the ØMQ thread pool to handle I/O operations.

receiver-threading-profileelementnoThe default receiver threading profile set on the Mule configuration

The threading properties to use when receiving events from the connector.

connection-pooling-profileelementno

Controls how the pool of connections should behave.

Endpoint Attributes

NameTypeRequiredDefaultDescription
exchange-patternrequest-response / one-way / pull / push / subscribe / publishyes

The messaging pattern used by the endpoint.

socket-operationbind / connectyes

Determines whether the endpoint accepts (bind) connections or connects (connect) to a socket.

addressstringyes

The socket address the endpoint is binding/connecting to.

multipartbooleannofalse

Whether a java.util.List payload is sent as a multi-part message. If set to true, each element in the list becomes a message part. Applies only to outbound endpoints. On inbound endpoints, multi-part messages are transformed to a java.util.List object where each element is a message part.

filterstringno

The criteria used to filter out messages. Applies only when the exchange-pattern attribute is set to subscribe. If not set, every received message is consumed.

Examples

Subscribing to a socket on an inbound endpoint

<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:zmq="http://www.mulesoft.org/schema/mule/zeromq"
      ...
      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/zeromq http://www.mulesoft.org/schema/mule/zeromq/current/mule-zeromq.xsd">

    <flow name="SubscribeOnInboundFlow">
        <zmq:inbound-endpoint address="tcp://localhost:8080" filter="Foo"
                              socket-operation="connect" exchange-pattern="subscribe"/>
        ...
    </flow>
    ...
</mule>

Receiving messages from multiple inbound endpoints

<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:zmq="http://www.mulesoft.org/schema/mule/zeromq"
      ...
      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/zeromq http://www.mulesoft.org/schema/mule/zeromq/current/mule-zeromq.xsd">

    <flow name="MultipleSourcesFlow">
        <composite-source>
            <zmq:inbound-endpoint address="tcp://localhost:8080" socket-operation="connect"
                                  exchange-pattern="subscribe"/>
            <zmq:inbound-endpoint address="tcp://*:8080" socket-operation="bind"
                                  exchange-pattern="pull"/>
        </composite-source>
        ...
    </flow>
    ...
</mule>

Pushing messages out

<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:zmq="http://www.mulesoft.org/schema/mule/zeromq"
      ...
      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/zeromq http://www.mulesoft.org/schema/mule/zeromq/current/mule-zeromq.xsd">

    <flow name="PushFlow">
        ...
        <zmq:outbound-endpoint address="tcp://*:8080" socket-operation="bind"
                               exchange-pattern="one-way"/>
        ...
    </flow>
    ...
</mule>

Sending messages as multi-part messages

<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:zmq="http://www.mulesoft.org/schema/mule/zeromq"
      ...
      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/zeromq http://www.mulesoft.org/schema/mule/zeromq/current/mule-zeromq.xsd">

    <flow name="MultiPartMessageOnOutboundFlow">
        ...
        <expression-transformer evaluator="groovy" expression="['1st part', '2nd part', '3rd part', '4th part', '5th part']"/>
        <zmq:outbound-endpoint address="tcp://*:8080" multipart="true"
                               socket-operation="bind" exchange-pattern="request-response"/>
        ...
    </flow>
    ...
</mule>

Receiving multi-part messages

<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:zmq="http://www.mulesoft.org/schema/mule/zeromq"
      ...
      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/zeromq http://www.mulesoft.org/schema/mule/zeromq/current/mule-zeromq.xsd">

  <flow name="MultipartInboundFlow">
      <zmq:inbound-endpoint address="tcp://*:8080" socket-operation="bind"
                            exchange-pattern="pull"/>
      <expression-transformer evaluator="groovy" expression="payload[3]"/>
      ...
  </flow>
  ...
</mule>