edgent-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Susan Cline <home4...@pacbell.net>
Subject Re: Standard commands for Quarks applications?
Date Mon, 16 May 2016 13:51:25 GMT

> On May 10, 2016, at 3:58 PM, Dan Debrunner <djd@debrunners.com> wrote:
> So the control service allows execution of operations (method calls) against registered
control MBeans from outside a Quarks application.
> Two implementation of the control service exist, JMX and JSON.
> JmxControlService registers the MBeans within the platform JMX server thus allowing standard
JMX control (remote clients etc.)
> JsonControlService registers the MBeans and allows a JSON control request object to invoke
an operation. The JSON object format is described (briefly) in the package for the JsonControlService
but its formatting was messed up so it doesn't appear in the Javadoc (I'll fix that). The
JSON control request object is passed directly into the JsonControlService instance to invoke
the method.

Has this been fixed yet?  When I look at the javadoc for JsonControlService I see:

A JSON object passed to controlRequest <file:///Users/susancline/new_git/incubator-quarks/target/docs/javadoc/quarks/runtime/jsoncontrol/JsonControlService.html#controlRequest-com.google.gson.JsonObject->
with these name/value pairs is handled as an operation resulting in a method call to a void
method on a control service MBean interface. 
type=type - MBean type.
alias=alias - Alias of the MBean.
op=name - Name of the operation to invoke, this is the method name on the MBean.
arguments=optional list of arguments - Arguments passed to the operation (method).
Is this correct now?

> Separately the IotProvider sets itself up so that an IoT device command with command
identifier `quarksControl' is sent to its JsonControlService. As long as a MBean can be identified
uniquely by a type and an alias the operation will executed against that control MBean.
> The command's data is the JSON control request, thus for example by sending a device
command with identifier `quarksControl` and data:
> {"type":"appService","alias":"quarks","op":"submit","args":["Heartbeat",{}]}
> Will result in this method being called against the MBean registered by the ApplicationService
to start the Heartbeat application.
> ApplicationServiceMXBean.submit("Heartbeat", "{}")
> Basically for the MBean of type 'appService' and alias 'quarks', call the method 'op'
with arguments 'Heartbeat' and an empty JSON object (there are auto string<->json conversions).

I got this working!  I was able to start an application on a raspberry pi that emitted sensor
readings from a remote command via IOTF.

> "All Quarks applications" is somewhat hard to answer, since Quarks is an SDK there can
be simple quarks applications that don't use IoTDevice, Iotf, the application or control services.
But if Quarks applications are running in the IotProvider framework then they will support
a number of commands:
> - submit application
> - change job state (e.g. to stop a running job)
> - any application that registers PeriodMBean's with a unique alias can have its period
change (e.g. a periodic source). This will obviously be application specific.
>> For example I think I have heard about a “start” and “stop” application command.
 Can someone tell me how these would work and if any other commands are available as
>> “standard” commands?
> The start command is the command above to submit an application previously registered
with the application service.
> I've just added a method to JobMXBean that will allow stopping a job now, and maybe pause

Great, I will try stopping a job for now and see if I can get that to work.  Thanks.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message