Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 434888

Summary: Server extensibility through asynchronous messaging (publishing of MQTT events)
Product: [ECD] Orion Reporter: John Arthorne <john.arthorne>
Component: ServerAssignee: Anthony Hunter <ahunter.eclipse>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: pascal, simon_kaegi
Version: unspecified   
Target Milestone: 6.0 M2   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description John Arthorne CLA 2014-05-14 14:12:40 EDT
The only API exposed by the Orion Java server are REST API. This is useful for providing on-demand requests for resources but provides no mechanism for extensible notification. For example if Orion is extended by creating a second  server, it would benefit from notification of changes from the core Orion file server. We should add publishing of MQTT events for key changes, to enable an extended group of tools to better integrate with Orion tools.

As a starting point, we should add the Paho MQTT client into Orion, and start publishing significant changes as events. This will rely on an administrator connecting Orion to an external message bus, rather than bundling an message bus implementation with the Orion server. This is the bundle with the client:

org.eclipse.paho.client.mqttv3

There is a repository available here:

https://repo.eclipse.org/content/repositories/paho-releases/
Comment 1 John Arthorne CLA 2014-05-14 15:28:42 EDT
There is some initial work in progress in this branch:

http://git.eclipse.org/c/orion/org.eclipse.orion.server.git/log/?h=johna/434888
Comment 2 Simon Kaegi CLA 2014-05-14 17:27:40 EDT
I've been wondering if something like this might be useful for our tasks service and decoupling the various pieces. That might involve having a bus...
Comment 3 John Arthorne CLA 2014-05-15 09:06:41 EDT
Yes I was wondering about that too. It depends on if we can get the right level of "stickiness" so the data is around long enough.
Comment 4 Anthony Hunter CLA 2014-05-21 12:39:49 EDT
(In reply to John Arthorne from comment #0)
> As a starting point, we should add the Paho MQTT client into Orion, and
> start publishing significant changes as events. This will rely on an
> administrator connecting Orion to an external message bus, rather than
> bundling an message bus implementation with the Orion server. This is the
> bundle with the client:
> 
> org.eclipse.paho.client.mqttv3
> 
> There is a repository available here:
> 
> https://repo.eclipse.org/content/repositories/paho-releases/

I am not sure how we would like to add this bundle into Orion. Paho does not have an update site, so it does not conveniently fit into our existing orion.target. 

Should we add the mqtt-client-0.4.0.jar directly into a lib folder in one of the Orion bundles?
Comment 5 John Arthorne CLA 2014-05-23 13:00:08 EDT
(In reply to Anthony Hunter from comment #4)
> Should we add the mqtt-client-0.4.0.jar directly into a lib folder in one of
> the Orion bundles?

We talked during Orion planning call and decided on this approach for now.
Comment 6 Anthony Hunter CLA 2014-05-27 13:26:12 EDT
Progress to date is in this branch:
http://git.eclipse.org/c/orion/org.eclipse.orion.server.git/commit/?h=ah-Bug434888
Comment 7 Anthony Hunter CLA 2014-05-29 16:23:23 EDT
I have pushed the changes to master.

To turn on the event service, you need to specify the URI for the MQTT message broker in your orion.conf as:
orion.events.uri=tcp://localhost:1883

You can also optionally provide a user and password for the broker:
orion.events.user={username}
orion.events.password={password}

Currently the only messages that are published are login events as:

Received PUBLISH (d0, q0, r0, m0, 'orion/login', ... (70 bytes))
{"event":"login","published":"2014-05-29T16:20:17.012Z","user":"anthonyh"}

So the topic is "orion/login" and the message is the event in JSON format.

We can make more progress on this enhancement during Orion 7.0 by adding the events and support clients require.
Comment 8 John Arthorne CLA 2014-06-04 15:30:41 EDT
Added some further information to the admin guide:

https://wiki.eclipse.org/Orion/Server_admin_guide#Turning_on_Asynchronous_Messaging