Northwind Example Application - Advanced Development Topic

From RifidiWiki

Jump to: navigation, search

Example: Northwind

Congratulations! You are the proud new founder of Northwind Shipping Inc. -- "delivering packages faster than a caffeinated lightning bug"™. One of your core business strategies is to out perform your competitor -- Pony Express Shipping Inc. -- by capitalizing on increased efficiencies gained by your innovative use of technology. You have heard all the hype about RFID and want to employ in it your new, state-of-the-art distribution center. You have decided to use the Rifidi Edge Server to run the RFID applications you will need in your distribution center. This tutorial will show you how to set up an application and use all the various features provided by the Rifidi Edge application API.

Northwind Business Rules

The Northwind distribution center's current process looks like this:

  • 1. Boxes (fitted with RFID tags) are loaded onto a pallet, which are transported via forklift (also outfitted with RFID tags) to a dock door. From the dock door, an inventory is taken.
  • 2. The forklift will then take the packages to a weigh station, where the packages would be weighed.
  • 3. After the weigh station, the packages would be sent out for shipping. RFID can add value to this workflow by monitoring whenever a tag enters or leaves an area (either the dock door or the weigh station), and do extra processing based on what happens when it enters and leaves an area.

A message should be printed when...

  • 1. a tag enters or leaves an area.
  • 2. a tag moves from the dock door to the weigh station.
  • 3. tags are seen with their forklift tag.

Occasionally, something can go wrong and an item will do something unexpected. Error messages should be printed if...

  • 1. Tags move from the weigh station to the dock door, stating that the tag moved backwards.
  • 2. Tags are seen on the weigh station which was not seen at the dock door.
  • 3. Item tags are seen without an accompanying forklift tag.

More documentation on how this was accomplished is given in the Esper documentation, as well as the

Setting up and running the Northwind Example

  • 1. Set up the eclipse workspace and import the SDK.
  • 2. Import the plugin from the “examples” directory in the SDK plugin.
  • 3. Go to Run > Run Configurations and click on “Edge Server” under “OSGi Framework” on the left.
  • 4. Select the package “org.rifidi.edge.northwind” in the “bundles” tab. Press “Apply”. Now either close and run the “Edge Server” launch framework or just press “run”.
  • 5. Type in “apps” and make sure the Northwind Application has started.

If you don't see the Northwind app at all, make sure the plugin is set to Auto-Start in the run configuration. If you see it but it is stopped, you will have to manually start it. Check the Applications section of the documentation for more help debugging problems starting applications. After you know the application is working, stop the edge server and open the org.rifidi.edge.northwind plugin. Copy the “Northwind” folder and paste it into the “Rifidi-SDK/RifidiHome/applications” folder. Then open the folder, and open the “” file. This shows all of the properties that can be adjusted for this application (see the application documentation for more on the properties files). You might need to adjust the names of the readers for the dock door and weigh station, depending on what the names of the readers are in Rifidi Edge. A more thorough explanation of each of the properties is in the file itself. The properties files for both the dock door and weigh station ReadZones are also in this folder. After the properties files are set up correctly, run the program and create the readers you want to use. If you want, you can use the included Prototyper file with an already set up dock door reader (, and an already set up weigh station reader ( If you like, you can use any physical readers you have access to, or you can use Emulator to create the readers of your choice and then use edge to connect to them. After you have connected to the readers set in the Northwind properties file, you can begin adding and removing tags from the field of view of the readers. Here is a sample of what you can do:

  • 1. Create 1 GID tag and 2 SSCC tags (this assumes that the “ForkliftPrefix” property is set to the default “35”).
  • 2. As a group, move all 3 tags into the field of view of the Dock Door reader. You should see 3 “tag arrived” messages for the dock door, plus a message telling you that a forklift was seen with the other tags.
  • 3. Delete all the tags from the field of view. You should get 3 “tag departed” messages for the dock door.
  • 4. Move the same 3 tags onto the weigh station reader. You should see 3 “tag arrived” events for the weigh station, as well as 3 events telling you that the tags have moved from the dock door to the weigh station. You should also get output telling you that a forklift was seen. This is only one example of what you can do; only some of the rules were used for it. Invoking the rules given above on your own, as well as studying the Esper used to create these rules will help you greatly when you are writing your own application.

Northwind Application Architecture

The Northwind application contains three parts:

  • 1. The application class: is where the program is set up, and all of the logic is implemented. Setting up the ReadZones, Subscribers, properties, and Esper all happens in this class. Check out the file itself for a more detailed explanation of how the application works.
  • 2. The event classes: These are simply shell classes that are created to be passed into Esper. They contain no information except for the ID of the tag that they represent, but any events you make can contain any information.
  • 3. The subscriber classes: These classes represent two different kinds of subscriber: one is a regular ReadZoneSubscriber, which will subscribe to ReadZones that we create and fire events based on certain criteria. The other is a StableSetSubscriber that will look for forklift tags and print output depending if a forklift is present when tags are read. For more information on how these classes work, check their respective files.

The Northwind files themselves are well-commented, and should help you get a better understanding of how applications are built and run. Other application plugins, such as the diagnostic tools ( should give you more examples of what you can do with applications, should you need more examples. Finally, if you need any more help with your application, go to our forums:

Personal tools