Chapter 10. External Domains and Connectors

Since tools are mostly neither developed for the OpenEngSB nor written in any way that they can be directly deployed in the OpenEngSB environment a way is required to connect via different programming languages than Java and from multible protocols. This section covers the examples in different languages and protocols, how such a thing can be achived.

10.1. Proxying

The proxy mechanism allows for any method call to be intercepted.

10.1.1. Proxying internal Connector calls

ProxyConnector automatically exports a ServiceManager for every Domain to instantiate a proxy. An InvocationHandlerFactory has to be provided for proxying any call. The proxy has to be created via the normal instantiation mechanism on the website.

10.2. Using JMS proxying

The current JMS Connector allows for internal method calls being redirected via JMS, as well as Events being raised through JMS via an external source.

10.2.1. Proxying internal Connector calls

ProxyConnector automatically exports a ServiceManager for every Domain to instantiate a proxy. The proxy has to be created via the normal instantiation mechanism on the website. Whenever now a proxy method is called the call is marshalled and sent via JMS to a queue named <DomainID>_method_send. The marshalling is done via JSON. The mapping has the parameters type, which can be Call, Exception or Return, message, which in case of a method call is a simple serialisation of the arguments and name, which denotes the name of the method.

After sending the method call via JMS the proxy waits for a return at <DomainID>_method_return. The return message can use the same parameters as the send serialisation (type, name, message), but name is ignored. The message parameter is serialised to the correct return type if type is set to RETURN. If the type is Exception a new JMSException is thrown with the message.

By default a JMS Broker is started on port 6000.

10.2.2. Event handling via JMS

For every Domain found at the start of the OPENEngSB Server JMSConnector starts a listener on the <DomainID>_event_send queue. The parameters used are type and event. The type parameter is the fully qualified class name that has to be used to deserialise the event and be used as the argument to raiseEvent. After the correct class is loaded the content of the event parameter gets deserialised into an instance of the type parameter. The corresponding raiseEvent method is then called for the domain supported by this EventListener.

A <contextId> property has to be set in the JMS message to configure the context that should to be used for the event handling.

When the Event was processed a message is sent to the <DomainID>_event_return queue with the type set to RETURN and message set to OK. In case of Exception the type is set to exception and the message is set to the exception message.

10.2.3. Examples

10.2.3.1. Connect With Python

To test the OPENENGSB JMS implementation with Python please follow the instructions

The example can be downloaded here

10.2.3.2. Connect With CSharp

The CSharp connector is written on basis of the Apache ActiveMQ NMS connector and with help of the Spring NmsTemplate. The code is checked into the repository and could be found in nonjava/csharp. There an EngSB.sln file. This project file has been developed with SharpDevelop 3, but is also tested with VisualStudio 2008 CSharp Express Edition with the .Net Framework 3.5.

The example can be downloaded here

10.2.3.3. Connect With Perl

As shown in this example you can connect to the OpenEngSB in a similar way as with Python or CSharp.

The example can be downloaded here