Whichever way you run the examples, the MQeBundle.jar bundle is required
by both the client and server and must be present on the Bundle Server.
To run the example, first start the Server:
- Import the MQeServerBundle.jar bundle onto the Bundle Server.
- Start a new SMF (Service Management Framework) runtime, and install and
start the MQeServerBundle bundle on it. This should also install the three
prerequisite bundles.
- The server then starts listening, you should see output on the console
including:
'MQeServerBundle - registering message listener'
This
means the server is ready for messages.
Next you need to run a client to send a message. There are two methods
for runnning the client bundle:
- Method 1
-
In the same SMF runtime as the server:
- Import the MQeClientBundle.jar bundle onto the Bundle Server.
- Install and start the MQeClientBundle bundle on the runtime.
- The client now starts and sends a message, which the server will print
on the console. You can stop and start the client bundle to send another message.
- Method 2
-
In separate SMF runtimes:
- Import the MQeClientBundle.jar bundle onto the Bundle Server.
- Start a new SMF runtime, and install and start the MQeClientBundle bundle
on it. This should also install the three prerequisite bundles.
- The client starts and sends a message, which the server will print on
the console. You can stop and start the client bundle to send another message.
By default the example expects both client and server to be on the same
machine running with the receiver listening on port 8085. However, you can
change the port and address of the server, that is run the server on a separate
machine. Before the server is started, tell it which port to run on by setting
the java system property, examples.osgi.server.port. This
can be set in the Runtime IDE by selecting Show runtime properties from
the drop down menu.
To tell the client the address and port that the server is listening on,
before starting the client set the system properties
examples.osgi.server.address and
examples.osgi.server.port.
Note: The server ignores the address property if it is not present.
Also, if the client has already been run and you want to change the address
and port, the runtime needs to be terminated and restarted to ensure that
old MQeConnectionDefinition information is wiped from memory.