Page 1 of 1
Indigo JMF Subscriptions - An Example
Posted: Tue Apr 21, 2015 5:54 pm
by gabrielp
Overview
If you want to get some information from your Indigo/DFE, you can always send it a JMF. But if you are actively monitoring the status of the device, you're better off with a JMF subscription which will notify an HTTP endpoint when something changes. Below you'll find an example on how to implement a basic JMF subscription endpoint using Node.
Requirements
Installation
Clone the GitHub repo (
https://github.com/dominickp/JMF-Subscription).
"cd" to the repository directory and run the following to install the needed node modules:
Code: Select all
npm install winston
npm install xml2js
npm install request
You should then see a folder in your repo called "node_modules/". In the repo directory, create an additional folder called "logs/".
Configuration
Edit "JmfSubscriptionInitalize.js" and set the "idp_endpoint" variable to be the URI for your JMF device (this could be the press or DFE). Then, set the "jmf_subscription_server" to be the HTTP endpoint the JMF device should update with the subscription (should be something like 'your_local_ip:9090'). You can get a little fancier with the JMF you send to the device. In my example, I just have a basic "QueryStatus" JMF being sent from a string.
Usage
"cd" to the repository directory and run the following command:
If it worked correctly, you should see a big XML (JMF) response:
Now that you have set your subscription, we need to launch our "jmf_subscription_server" to capture the messages as they are sent. Run the following command:
You'll see an immediate response that the server is listening to the specified port. In my example: "Server listening on:
http://localhost:9090".
Now wait a bit and you'll start to see some updates in the JmfSubscriptionServer.js window:
Thanks to winston, the responses are also logged in a log file in "logs/":

Re: Indigo JMF Subscriptions - An Example
Posted: Fri Dec 18, 2015 9:39 pm
by gabrielp
I've made several updates to this. It now scans your DFE for JMF-ready devices and subscribes all of them. The server now saves to a database. It's controlled via command line arguments.
https://github.com/dominickp/JMF-Subscription
Re: Indigo JMF Subscriptions - An Example
Posted: Mon Dec 21, 2015 1:16 pm
by kevinjel
hello Gabriel,
Thanks for the posted information.
If you want to get some information from your Indigo/DFE, you can always send it a JMF
I'm a starter with this, my understanding of a JMF is the response of what the machine has produced / done. Is there documentation how this works. and if i'm correct u do requests to the DFE?? You are displaying the status of the indigo press in the command line. is there also an option to ask for amount of copies printed of a specific job? amount of impressions, print time?
heck if that is possible, i'd love to dive into it.
Re: Indigo JMF Subscriptions - An Example
Posted: Mon Dec 21, 2015 3:33 pm
by gabrielp
kevinjel wrote:I'm a starter with this, my understanding of a JMF is the response of what the machine has produced / done. Is there documentation how this works. and if i'm correct u do requests to the DFE?? You are displaying the status of the indigo press in the command line. is there also an option to ask for amount of copies printed of a specific job? amount of impressions, print time?
heck if that is possible, i'd love to dive into it.
You can query lots of different information. For example, the queue of the press or the status of a specific job. In the example above, I'm using a the generic basic status query. There's documentation and examples in HP's "HP Indigo JDF IDP Worker SDK" which can be found here:
http://www.hpwsn.com . In the query in the example I provided, the "ProductionCounter" is the impression count and I'm sure there's a way to query a specific job to see the number of clicks.
Re: Indigo JMF Subscriptions - An Example
Posted: Wed Dec 23, 2015 6:05 pm
by sander
Another way around; If you submit your JDF via a JMF with SubmitQueueEntry you can define a ReturnJMF URL. When your job is printed it returns a JDF ticket which includes clicks, start and end time, used substrate etc.
That way don't have to query the DFE, it just sends the information when the job is done.
Anyway, your script is really interesting Gabriel. Next year I need to get more information from the DFE's / Production Center so will look in your script for sure. Still figuring out if go all the way with the RestAPI or JDF/JMF, or mixed

Re: Indigo JMF Subscriptions - An Example
Posted: Tue Jan 05, 2016 6:57 pm
by gabrielp
I've updated the repo readme with some example charts I was able to make with this data.
sander wrote:Anyway, your script is really interesting Gabriel. Next year I need to get more information from the DFE's / Production Center so will look in your script for sure. Still figuring out if go all the way with the RestAPI or JDF/JMF, or mixed

Do you know anything about the REST API for indigos? Is there an SDK? I've love to work with REST instead.
Re: Indigo JMF Subscriptions - An Example
Posted: Wed Jan 06, 2016 5:19 pm
by sander
Hm, I thought the Rest API was supported by both Production Pro as Production Center. I just looked for the documentation but couldn't find any rest api info, my bad, it seems to be Production Center only.
Sorry for giving you bad hope

Re: Indigo JMF Subscriptions - An Example
Posted: Mon Nov 28, 2016 10:46 am
by lombert
gabrielp wrote:Configuration
Edit "JmfSubscriptionInitalize.js" and set the "idp_endpoint" variable to be the URI for your JMF device (this could be the press or DFE). Then, set the "jmf_subscription_server" to be the HTTP endpoint the JMF device should update with the subscription (should be something like 'your_local_ip:9090'). You can get a little fancier with the JMF you send to the device. In my example, I just have a basic "QueryStatus" JMF being sent from a string.
I don't knew if I missed something but I can't find "JmfSubscriptionInitalize.js".
Have downloaded 'GitHub repo (
https://github.com/dominickp/JMF-Subscription)' Unpacked it @ my Application folder.
Downloaded 'Node v6.9.1 LT'S
Run 'npm install winston', 'npm install xml2js' and 'npm install request' all went OK.
Then run 'sudo npm install jmf-subscription -g'
But I can't still find "JmfSubscriptionInitalize.js" or run 'node JmfSubscriptionInitalize.js'
What have I missed?

Re: Indigo JMF Subscriptions - An Example
Posted: Mon Nov 28, 2016 11:06 am
by lombert
And I tried this:
Code: Select all
jmf-spy --action=subscribe --idp http://hpro1-sm1:8080/prodflow/jmf/ --server http://192.168.30.214:9090
and gets this error:
Code: Select all
error: Error body=undefined
/usr/local/lib/node_modules/jmf-subscription/node_modules/nedb/lib/datastore.js:77
if (err) { throw err; }
^
Error: ENOENT: no such file or directory, open '/usr/local/lib/node_modules/jmf-subscription/src/js/../../db/server.db'
at Error (native)
Re: Indigo JMF Subscriptions - An Example
Posted: Mon Nov 28, 2016 4:48 pm
by gabrielp
Sorry about that, this repo has changed a little bit since I wrote this post.
Ah, it's a permissions error. It can't create the database. You could go find that folder in the error and make the ./db/server.db file writable or do the following:
- Navigate to the folder where you unpacked the JMF-Subscription code
- Run npm install in that directory
- Ensure that ./db/server.db exists and is writable. If it doesn't exist, creating an empty file and putting it there will probably work.
- Replace the commands in the readme that say "jdf-spy" with "node ./src/js/interface.js". For example:
---- jmf-spy --action=[action]
---- becomes
---- node ./src/js/interface.js --action=[action]
Re: Indigo JMF Subscriptions - An Example
Posted: Tue Nov 29, 2016 8:34 am
by lombert
Thanks!
Now it started.