C H A P T E R  6

Sending Events From the RFID Event Manager to the RFID Information Server

The easiest way to send the RFID tag events from the RFID Event Manager to a database is to use the Epcis connector (a component of the RFID Event Manager), the RFID Information Server (also known as EPCIS), and an application server. There are other ways to accomplish this task, but they require more programming.

The Epcis connector can be used with two protocols: the Java Message Service (JMS) API and HTTP. The resulting connectors are called the EpcisHttp connector and the EpcisJms connector.

This chapter includes the following topics:


Prerequisites for Using the Epcis Connectors

The following software must be installed and properly configured before you can use the procedures in this chapter.


Enabling Usage of JMS With the RFID Information Server

Sun Java System Application Server 8.1 (Application Server) provides support for applications that use the Java Message Service (JMS) application programming interface (API) for messaging operations. JMS is a set of programming interfaces that provide a common way for Java applications to create, send, receive, and read messages in a distributed environment. JMS is a standard way that Java 2 Platform, Enterprise Edition (J2EEtrademark platform) applications perform asynchronous messaging. J2EE components, web components or Enterprise JavaBeanstrademark (EJBtrademark) components - can use the JMS API to send messages that can be consumed asynchronously by a specialized EJB, called a Message Driven Bean (MDB).

An MDB is similar to a session bean, except it responds to a JMS message rather than an RMI event. MDBs were introduced in the EJB 2.0 specification. The MDB represents the integration of JMS (Java Message Service) with the EJB software to create an entirely new type of bean designed to handle asynchronous JMS messages.

Application Server support for JMS messaging and for MDBs, requires messaging middleware, a JMS provider, that implements the JMS specification. Application Server uses Sun Javatrademark System Message Queue 3 2005Q1 (Message Queue) as its native JMS provider. The Sun Java System RFID Information Server installer creates the following JMS resources on the application server:


TABLE 6-1 Java Message Service Resources

JMS Resource

JNDI Name

Topic Connection Factory

jms/TopicConnectionFactory

Topic

jms/epcisTopic

Physical Destination

epcisTopic

Queue Connection Factory

jms/QueueConnectionFactory

Queue

jms/epcisQueue

Physical Destination

epcisQueue


RFID Information Server clients can be configured to use the JMS interface using a file system JNDI provider (Java Naming and Directory Interface).

This section include the following topics:

Sun Java System Message Queue Documentation

The Sun Java System Message Queue 3 2005Q4 Administration Guide can be found at http://docs.sun.com/app/docs/doc/819-2571.

The complete documentation set for Sun Java System Message Queue 3 2005Q4 can be found at http://docs.sun.com/app/docs/coll/1307.1.

Enabling Usage of JMS with Sun Java System Application Server 8.1

The RFID Information Server installer creates the necessary JMS resources on the Application Server. You need to configure the Java Naming and Directory Interfacetrademark (JNDI) File System Provider object store.

See Sun Java System Application Server Platform Edition 8.1 2005Q2 Update 2 Administration Guide found at http://docs.sun.com/app/docs/doc/819-2641 for more information on configuring JMS Resources and understanding JNDI resources. It is not the intent of this guide to fully explain these topics. The following illustration shows how the RFID Event Manager queries the JNDI repository to determine the physical parameters necessary for using the JMS messaging protocol.


Illustration showing RFID Event Manager communication flows using the JMS and HTTP protocols. When using JMS, the RFID Event Manager must do a JNDI lookup to get the actual values for the destination queue or topic.

The procedures in this chapter show screen captures using Application Server Platform Edition on a Windows system. Using the Application Server and Message Queue GUI interfaces on other platforms may differ slightly in appearance.

Perform the following procedures in the order they are presented:


procedure icon  To Confirm the JMS Resources on the Application Server

The RFID Information Server installer creates JMS resources for you. This procedure describes how to view and confirm that these resources were successfully created.

1. Start the application server default server instance.

2. Log in to the application server admin console.

3. Choose Resources right arrow JMS Resources right arrow Connection Factories.

Confirm that the jms/QueueConnectionFactory and jsm/TopicConnectionFactory nodes are present as shown in the following screen capture.


Screen capture of the Application Server Platform Edition Admin console showing the RFID JMS connection factory resources.

4. Choose Resources right arrow JMS Resources right arrow Destination Resources nodes.

Confirm that the jms/epcisTopic and jsm/epcisQueue nodes are present as shown in the following screen capture.


Screen capture of the Application Server Platform Edition Admin console showing the RFID JMS destination resources.


procedure icon  To Add the Broker Using Sun Java System Message Queue

You need to a add a broker that points to your local JMS Message Queue server, or whichever Message Queue server you want to use.



Note - This example uses the Sun Java System Message Queue that is installed as part of the Sun Java System Application Server 8.1 installation.



1. Start the Message Queue admin console.

These examples use the default Application Server installation directory for each platform.


Screen capture showing Message Queue Admin Console.

2. Select the Brokers node in the navigation tree.

3. From the menu, choose Actions right arrow Add Broker.

The Add Broker dialog box appears.


Screen capture showing Add Broker dialog box. Data fields are Host, Primary Port, Username, and Password. Buttons are OK, Reset to Defaults, Cancel, and Help.

4. Add a new broker by following these steps:

a. In the Broker Label field, type a name for your broker.

For this example, type TestRFIDBroker.

a. In the Host field, type the IP address of the machine where your Message Queue server is installed.

In this example, this is the system where Application Server is installed.

b. In the Primary Port field, confirm the default value of 7676.

c. Type the Message Queue admin username and password.

The admin username and password is admin.

d. Click OK.


Screen capture of Message Queue Admin Console showing the added broker.

5. Right-click the new Broker icon in the navigation tree and choose Connect to Broker.

For this example, right-click TestRFIDBroker. The destinations match the destinations that you viewed in the Application Server JMS Resources.


Screen capture showing the epcisQueue and epcisTopic JMS Destinations for the new broker.


procedure icon  To Add an Object Store for RFID Information Server

From the Message Queue admin console, add a new Object Store by following these steps:

1. Select the Object Stores node in the navigation tree.

2. From the menu, choose Actions right arrow Add Object Store.

The Add Object Store dialog box appears and enables you to add the necessary JNDI Naming Server Properties. The following screen capture shows the JNDI Naming Server Properties drop-down list.


Screen capture showing the Add Object Store dialog. Buttons are OK, Clear, Cancel, and Help.

3. Add the following fields:


Object Store Property Name

Example Value

java.naming.factory.initial

com.sun.jndi.fscontext.RefFSContextFactory

java.naming.provider.url

  • (UNIX) - file:///opt/imq/imq_admin_objects
  • (Microsoft Windows) - file:///C:/Sun/Appserver/imq/imqdata

java.naming.security.prinicpal

tester (or a user name that you specify)

java.naming.security.credentials

password for the user specified in java.naming.security.principal


4. In the Object Store Label field, type a name for this object store.

For this example, type EpcisObjectStore.

5. When finished, click OK.

The new Object Store appears in the navigation tree.


Screen capture showing the new object store.

6. Right-click the new Object Store node in the navigation tree and choose Connect to Object Store.

You should see a successful connection.


procedure icon  To Add a Topic Connection Factory

From the Message Queue admin console, add a new connection factory for the epcisTopic by following these steps:

1. Select the Connection Factories node in the navigation tree.

2. From the menu, choose Actions right arrow Add Connection Factory Object.

The Add Connection Factory Object dialog box appears.


Screen capture showing Add Connection Factory Object dialog box. Buttons are OK, Reset To Defaults, Cancel, and Help.

3. Type the Lookup Name.

For this example, use TopicConnectionFactory.

4. In the Factory Type field, select TopicConnectionFactory from the drop-down list.

5. Select the 3.0 Connection Handling tab and complete the fields as shown in the following screen capture.

In the fields, Broker Host Name and HTTP URL, replace localhost with the name of the machine where your Message Queue broker resides.


Screen capture showing fields for the new topic connection factory object.

6. Click OK.

The topic connection factory object is added to the object store.


procedure icon  To Add a Queue Connection Factory

1. Select the Connection Factories node in the navigation tree.

2. From the menu, choose Actions right arrow Add Connection Factory Object.

The Add Connection Factory Object dialog box appears.

3. Type the Lookup Name.

For this example, use QueueConnectionFactory.

4. In the Factory Type field, select QueueConnectionFactory from the drop-down list.

5. Select the 3.0 Connection Handling tab and complete the fields as shown in the following screen capture.

In the fields, Broker Host Name and HTTP URL, replace localhost with the name of the machine where your Message Queue broker resides.


Screen capture showing the fields for the new queue connection factory object.

6. Click OK.

The new queue connection factory object is added to the object store.


procedure icon  To Add the EPCIS Destination Objects

1. Select the Destinations node in the navigation tree.

2. From the menu, choose Actions right arrow Add Destination Object.

The Add Destination Object dialog box appears.

3. Add both a topic and a queue destination object as shown in the following screen captures.


Screen capture showing the fields for the required topic destination object.Screen capture showing the fields for the required queue destination object.

Screen capture showing the fields for the required topic destination object.Screen capture showing the fields for the required queue destination object.

 

4. Confirm that your new object store appears similar to the following screen capture.


Screen capture of the Message Queue admin console showing the completed object store with the EPCIS destination objects.

5. When you are finished, exit the Message Queue Admin Console.

You have completed the JMS configuration for your system. Now, you must configure the RFID Event Manager to send the tag events to the RFID Information Server. See Configuring the RFID Event Manager to Use an EpcisJms Connector.


Configuring the RFID Event Manager to Use an EpcisJms Connector

The following procedures use the RFID Configuration Manager, a component of the RFID Event Manager. If you are unfamiliar with this component, review Chapter 2 to familiarize yourself with the GUI terminology and functionality before proceeding.

Prerequisite - Be sure that you have reviewed Enabling Usage of JMS With the RFID Information Server and enabled JMS before starting this procedure.

Perform the following procedures:


procedure icon  To Define the EpcisJms Connector Role

Use these steps to define a new role that uses the EpcisJms connector. A role specifies a series of filters and connectors that receive tag events and pass them to a listener application. In this example, the Westerner is the RFID Information Server.

Roles are described in Chapter 2 of this guide. Review To Define RFID Event Manager Roles if you have not used the RFID Configuration Manager previously.

Prerequisite - You must create your JNDI object store before performing this procedure. See Enabling Usage of JMS With the RFID Information Server.

1. Start the RFID Configuration Manager.

The location of the start script depends on your platform:

2. Choose Roles right arrow New.

The Select a Role dialog appears.

3. Type the new role name and click Ok.

For this example, type JMS Message for IS. The drawing pane appears.


Screen capture of the empty JMS Role drawing pane.

4. Click the Add a connector icon (looks like a roll of film) and select EpcisJms from the list.


Screen capture showing the Select a Connector dialog with unique name of JMSConnector in the data field. Buttons are Ok and Cancel.

5. Type a name and click OK.

For the example, type JMSConnector. The Epcis connector named JMSConnector appears in the drawing pane.


Screen capture showing the RFID Configuration Manager drawing pane with the added JMSConnector.

6. Right-click the connector (move the cursor over the small square at the center of the Connector symbol) and select Edit.

The Connector Details dialog appears.

7. Confirm that the Configuration Properties fields contain the correct values for your JMS configuration and click OK.

The values of the java.naming properties must match the values in your JNDI object store as shown in the following table.


Configuration Property Name

Value

java.naming.factory.initial

com.sun.jndi.fscontext.RefFSContextFactory

java.naming.provider.url

  • UNIX - file:///opt/imq/imq_admin_objects
  • Microsoft Windows - file:///C:/Sun/Appserver/imq/imqdata

java.naming.security.prinicpal

tester (the user name that you specified for connecting to the RFID Information Server)

java.naming.security.credentials

password for the user specified in java.naming.security.principal

TopicName

epcisTopic

ConnectionFactory

TopicConnectionFactory


8. Add a Delta filter by using the Add a filter icon (looks like a meter).

You must use a Delta filter to feed the tag events to the EpcisJms connector. If you do not add the Delta filter to this role, the tag events are ignored by the connector.

9. Type a name for your Delta filter and click OK.

10. Add a Smoothing filter by using the Add a filter icon (looks like a meter).

11. Type a name for your Smoothing filter and click OK.

The drawing pane appears similar to the following screen capture.


Screen capture showing the drawing pane with the added Delta and Smooting filters and the JMSConnector.

12. Right-click on the Smoothing filter and select Create Input from the popup menu.

A new input object appears on the drawing pane.

13. To connect everything together, click the port (small square) at the center of the input and drag it to the Smoothing filter.

14. Click the port of the Smoothing filter and drag it to the Delta filter.

15. Click the port of the Delta filter and drag it to the JMSConnector.

16. Click on the Auto-Layout icon to arrange the components vertically on the drawing pane.

This enables you to see how the tag events flow through this role.



Note - The drawing pane icons are described in TABLE 2-1.



Your drawing pane appears similar to the following screen capture.


Screen capture showing the drawing pane in the RFID Configuration Manager. Drawing pane shows the completed EpcisJms Connector.

17. Click Close.

Your work is not yet saved. To save your work at this time, choose File right arrow Save from the RFID Configuration Manager main menu.

18. You must complete the following procedure to configure the EpcisJMS configuration object.


procedure icon  To Create the EpcisJms Configuration Object

1. Choose Configuration right arrow New.

The Select the Base Role dialog box appears.

2. Select the role, JMS Message for IS, that you defined in the previous procedure and click OK.

The Configuration Object properties dialog appears. Notice that there are three tabs corresponding to the components that you defined in the JMS Message for IS role.

3. Type a name in the Configuration Object Name field.

For this example, type JMSConfigObject.

4. To configure the input point for the configuration object, select a reader by following these steps:

a. Click Select a Reader.

b. (For demonstration or verification purposes) Select PMLReader.

When you select the reader, the configuration properties for that reader profile appear.

c. (If using a real reader, rather than the PMLReader) Select your reader and confirm that the reader properties correspond to the reader you are using.

When defining the EpcisJms connector in a real-world situation, you would define your readers (devices) first. Then, when you define your configuration objects, the list of possible input points would display all your defined readers (devices). See Chapter 2 for more information.

5. Click OK.

6. If the drawing pane displays the default Demo configuration object, delete it following these steps.

a. Select the Demo configuration object.

b. Choose Configuration right arrow Delete.

7. Choose File > Save to save your changes and click OK when prompted.

8. (Optional) To exit the RFID Configuration Manager, choose File right arrow Exit.

9. (Optional) To test the EpcisJms connector, perform the next procedure To Test the EpcisJms Connector.


procedure icon  To Test the EpcisJms Connector

1. Start or restart your application server.

2. Start or restart the RFID Event Manager.

Each time you change a configuration object, the RFID Event Manager must be restarted in order for the changes to take effect. Wait until the system is completely started or you may lose tag events. Depending on the components you used in your role, the RFID Tag Viewer may or may not appear (it depends on the objects in your role). The delay lets the system come up completely before generating EPC tags.

3. Start the PML Reader.

4. Start the RFID Tag Viewer from the command line using the following options.

tagviewer -p PMLReader

You should see tags appearing in the RFID Tag Viewer.

5. After a few seconds, you can stop the PML Reader.

6. (Optional) To verify that events are flowing from the RFID Event Manager to the RFID Information Server, follow these steps:

a. In your web browser, access the RFID Information Server index page by typing the EPCIS URL.

For example, http://localhost/epcis.

b. Select Epcis Reporting Framework right arrow Epcis Tables.

Scroll down to the OBSERVATION_LOG table.

The TagsIn and TagsOut that have been added to the OBSERVATION_LOG table indicate that tags were read and were taken out of view from the RFID Event Manager. You should see something similar to the following screen capture.


Screen capture of the OBSERVATION_LOG EPCIS table displayed in a browser.


Configuring the RFID Event Manager to Use an EpcisHttp Connector

To use HTTP to communicate with the RFID Information Server, use an EpcisHttp connector. The tasks for configuring an EpcisHttp connector are similar to configuring a EpcisJms connector, except you do not need to do the JMS configuration. Perform the following procedures:


procedure icon  To Define the Epcis Connector Role

1. Start the RFID Configuration Manager.

2. Choose Roles right arrow New.

The Select a Role dialog appears.

3. Type the new role name and click Ok.

For this example, type testEpcisHttpRole.

4. Click the Add a connector icon (looks like a roll of film) and select EpcisHttp from the list.

5. Type a name and click OK.

6. To edit/confirm the properties, right-click the connector and choose Edit.

Move the cursor over the port (the small square at the center of the connector object). The Connector Details dialog box appears.


Screen capture showing the connector details for the EpcisHttp connector role.

7. Confirm that the properties contain the correct values, and click OK.

8. Add a Smoothing filter and a Delta filter.

See Step 8 through Step 11 in To Define the EpcisJms Connector Role.

9. Right-click the Smoothing filter and choose Create Input from the context menu.

10. To connect everything together, click the port (small square) at the center of the input and drag it to the Smoothing filter.

11. Click the port of the Smoothing filter and drag it to the Delta filter.

12. Click the port of the Delta filter and drag it to the EpcisHttpConnector.

13. Drag the components to arrange them on the drawing pane as needed or click on the Auto-Layout icon to arrange the components vertically.

This enables you to see how the tag events flow through the role.



Note - The drawing pane icons are described in TABLE 2-1.



Your drawing pane appears similar to the following screen capture.


Screen capture showing an example role using an EpcisHttp connector.

14. Click close and proceed to the next procedure,

Your work is not yet saved. Do not exit the RFID Configuration Manager without saving your work.


procedure icon  To Create the EpcisHttp Configuration Object

1. Start the RFID Configuration Manager.

2. If the drawing pane displays the default Demo configuration object, delete it following these steps.

a. Select the Demo configuration object.

b. Choose Configuration right arrow Delete.

3. Choose Configuration right arrow New.

The Select the Base Role dialog box appears.

4. For this example, select the role, testEpcisHttpRole, that you defined in the previous procedure and click OK.

The Configuration Object properties dialog appears. Notice that there are three tabs corresponding to the components that you defined in the role.

5. Type a name in the Configuration Object Name field.

For this example, type HTTPConfigObject.

6. To configure the input point for the configuration object, select a reader by following these steps:

a. Click Select a Reader.

b. (For demonstration or verification purposes) Select PMLReader.

When you select the reader, the configuration properties for that reader profile appear.

c. (If using a real reader, rather than the PMLReader) Select your reader and confirm that the reader properties correspond to the reader you are using.

When defining the EpcisHttp connector in a real-world situation, you would define your readers (devices) first. Then, when you define your configuration objects, the list of possible input points would display all your defined readers (devices). See Chapter 2 for more information.

7. Click OK.

8. Choose File > Save to save your changes and click OK when prompted.

9. (Optional) To exit the RFID Configuration Manager, choose File right arrow Exit.

10. (Optional) To test the EpcisHttp connector, perform the next procedure


procedure icon  To Test the EpcisHttp Connector

1. Start or restart the RFID Event Manager.

Each time you change a configuration object, the RFID Event Manager must be restarted in order for the changes to take effect.

Wait until the system is completely started or you may lose tag events. Depending on the components you used in your role, the RFID Tag Viewer may or may not appear (it depends on the objects in your role). The delay lets the system come up completely before generating EPC tags.

2. Start the PML Reader.

3. Start the RFID Tag Viewer from the command line using the following options.

tagviewer -p PMLReader

You should see tags appearing in the RFID Tag Viewer.

4. After a few seconds, you can stop the PML Reader.

5. (Optional) To verify that events are flowing from the RFID Event Manager to the RFID Information Server, follow these steps:

a. In your web browser, access the RFID Information Server index page by typing the EPCIS URL.

For example, http://localhost/epcis.

b. Select Epcis Reporting Framework right arrow Epcis Tables.

Scroll down to the OBSERVATION_LOG table.

The TagsIn and TagsOut that have been added to the OBSERVATION_LOG table indicate that tags were read and were taken out of view from the RFID Event Manager. You should see something similar to the following screen capture.


Screen capture of the OBSERVATION_LOG EPCIS table displayed in a browser.