Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Anchortoptop

The servicemix-wsn2005 JBI Component

...

To create a subscription for a given JBI endpoint, you can use the following code:

...

...

To publish a message on a given topic:

...

...

where message is a DOM element.

You can also create pull points and subscriptions for them:

...

...

Later, you can pull notifications from this pull point:

...

...

Outside the JBI bus

If you want to use WS-Notification ouside the JBI world, you will need to be able to receive incoming requests or send notifications to the external services. This must be done through by using Binding Components, either using HTTP or JMS.

To expose the NotificationBroker and CreatePullPoint services using HTTP/SOAP, you can deploy the following configuration file to servicemix-http:

...

...

Embedding WS-Notification

If you use a single static configuration file for ServiceMix, you can easily leverage this component to create subscription, pull-points and publish messages.

...

...

The above code snippet creates a publisher proxy, a subscription and a subscriber.

The publisher proxy is a simple component that wraps incoming JBI exchanges into WS-Notification notify requests and send them to a notification broker on the given topic. This could also be written in plain spring style:

...

When the component is started, it registers itself as a publisher to the WS-Notification broker. To do so, it activates a JBI endpoint named subscription so it can handle demand based publishing. When this component receives an InOnly exchange, let's say <hello>world</hello>, it will wrap it in a request as shown here and send the request as an InOnly exchange to the NotifiationBroker. Note that, as this component activates two JBI endpoints, you need to explicitely target the endpoint specified in the activationSpec when sending a message.

The subscription is created inside a servicemix-wsn2005 component. You must fill the consumer and topic properties, where the consumer is the URI-encoded target JBI endpoint, which will be resolved to the first component activated. You could also use the plain spring syntax:

...

...

WS-Notification messages

The following xml snippets are just examples of WS-Notification requests. You should refer to the specification for more informations.

Subscribe

...

This request will create a subscription on the myTopic topic and will send messages to the JBI endpoint identified by its URI. In this case, the endpoint: protocol is used to identify an endpoint on the JBI bus.

CreatePullPoint

...

...

Wiki MarkupNote that the {{<sm:address/>}} element is a ServiceMix extension that creates a PullPoint on a specific JBI endpoint (\[namespace]\[sep]\[service]\[sep]\[endpoint], see [URIs]). This is very useful when you want to create a subscription for this endpoint at deployment time (see the previous paragraphparagraph).

The <sm:name/> element is a second ServiceMix extension that can be used to specify the name of the PullPoint. Such a name is used as JMS queue name, so it may be useful to specify it if you want to address a specific queue. If none is set, a queue name will be automatically generated (note that some JMS providers may require some administration tasks to be performed to create a JMS destination).

Notify

The Notify request is sent by a publisher to the NotificationBroker. This request contains a list of NotificationMessage, each one containing:

...

Below is an example of a such a request.

...

...