You are hereTutorial - JMF Status Subscription
Tutorial - JMF Status Subscription
In this tutorial you will learn why you need JDF Status Subscriptions and how it works. Using a JMF Query for status subscription you can subscribe to a periodic status signal and all status changes of a JDF Device. Examples for status changes are "job is finished", "status change from make ready time to running", "employee is logged in or out". The following is a sample of a JMF Query for status subscriptions:
<?xml version="1.0" encoding="UTF-8"?>
<JMF xmlns="http://www.CIP4.org/JDFSchema_1_1" MaxVersion="1.4"
TimeStamp="2010-06-22T18:48:19+02:00" Version="1.4"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="JMFRootMessage">
<Query AcknowledgeURL="http://gateway.url" ID="m_100622_184819343_000000" Type="Status" xsi:type="QueryStatus">
<Subscription RepeatTime="10" URL="http://gateway.url">
<ObservationTarget ObservationPath="*"/>
</Subscription>
<StatusQuParams DeviceDetails="Brief" JobDetails="Brief"/>
</Query>
</JMF>The most significant attributes in the snippet above are "RepeatTime" and "URL" in the Subscription node. The "RepeatTime" attribute defines the period of time between the status signals. The attribute "URL" defines the target URL where the signal has to be sent. Here is a sample of a JMF Status Signal:
<?xml version="1.0" encoding="UTF-8"?>
<JMF MaxVersion="1.3" SenderID="01-Suprasetter105-1" TimeStamp="2010-12-21T15:54:14-05:00" Version="1.3" xmlns="http://www.CIP4.org/JDFSchema_1_1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="JMFRootMessage">
<Signal ID="m_101221_15541420_002604" Type="Status" refID="m_100622_184819343_000000" xsi:type="SignalStatus">
<StatusQuParams DeviceDetails="Brief" JobDetails="Brief"/>
<DeviceInfo DeviceID="01-Suprasetter105-1" DeviceOperationMode="Productive" DeviceStatus="Idle" IdleStartTime="2010-12-21T14:45:54-05:00">
<Employee ProductID="E6" Roles="Operator">
<Person DescriptiveName="Stefan Meissner"/>
</Employee>
</DeviceInfo>
</Signal>
</JMF>The content of JMF Status Signals varies from target system and situation. The sample above was written by the JDF Device "01-Suprasetter105-1" simulated by CIP4 Bambi 2. As you can see the message says the operator "Stefan Meissner" is currently logged in, the operation mode of the target device is productive, but no job is processing (DeviceStatus: Idle). When a job is processed the DeviceStatus attribute changes and additionally the job details would be added to the content. Using the JMF Command "StopPersistentChannel" all subscriptions for a target url can be removed:
<?xml version="1.0" encoding="UTF-8"?>
<JMF MaxVersion="1.4" TimeStamp="2010-06-27T17:56:04+02:00" Version="1.4" xmlns="http://www.CIP4.org/JDFSchema_1_1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="JMFRootMessage">
<!--Generated by the CIP4 Java open source JDF Library version : CIP4 JDF Writer Java 1.4a BLD 61-->
<Command AcknowledgeURL="http://gateway.url" ID="m_100627_17560591_000000" Type="StopPersistentChannel" xsi:type="CommandStopPersistentChannel">
<StopPersChParams URL="http://gateway.url"/>
</Command>
</JMF>
Running this Tutorial in jdf4you Virtual Machine (jdf4you-vm)
jdf4you-vm is a virtual machine preinstalled and preconfigured within a JDF test framework (JDF Editor & Bambi 2). For more details click here. All message files needed to run this tutorial come with the latest jdf4you-vm version. In the home directory of user "jdf4you" (/home/jdf4you) there is a folder "jdf4you Tutorials", which contains a subfolder "Status Subscription", which contains a subfolder "TUTORIAL_FOLDER".
- Step 1: Start JDF Editor and load JMF Query "StatusSubscription" Start JDF Editor by clicking on the JDF Symbol in the launcher bar in jdf4you-vm. After the JDF Editor starts, open file "StatusSubscription.jmf" located in TUTORIAL_FOLDER.
- Step 2: Configure gateway URL and start Http-Server In JDF Editor open tab "HTTP Server", in the drop-down-list IP-Address select item "127.0.0.1" and press start (for more details about Http Server please click here). Out-of-the-box the default port is 8280 so the current gateway url is "http://127.0.0.1:8280/jmf/".
- Step 3: Check gateway URL In JDF Editors Tree View you can browse through the JMF Message "StatusSubscription.jmf". In node "Subscription" there is an attribute "URL". This attribute has to be set to the JDF Editors gateway URL ("http://127.0.0.1:8280/jmf/").
- Step 4: Send JMF Message to a target JDF Device simulated by Bambi 2 Bambi 2 automatically starts in the background when the system is booted. For this tutorial we can take the simulated JDF Device "01-Suprasetter105-1". Out of the box the URL of this device is http://127.0.0.1:8080/bambi-2/jmf/01-Suprasetter105-1. In order to send the status subscription message to 01-Suprasetter105-1 open the menu "Tools" and press on menu item "Send JDF...". An input box appears where you can type in the url (More details about "Send JDF..." here).
That's it! If everything goes well, a new item will appear every ten seconds in the received messages list. Double clicking on an item displays its message in JDF Editor.
- Step 5: Unsubscribe to Status Signals Using the JMF Command "StopPersistentChannel" all subscriptions for a target url can be removed. You can find the message ("StopPersistentChannel.jmf") in the "TUTORIAL_FOLDER" as well. In order to remove all messages subscribed to by the JDF Editor, open the "StopPersistentChannel.jmf" file in the "TUTORIAL_FOLDER". In JDF node StopPersChParams change attribute "URL" to JDF Editors gateway URL ("http://127.0.0.1:8280/jmf/") and send the message to the target JDF Device ("http://127.0.0.1:8080/bambi-2/jmf/01-Suprasetter105-1")


