# Workflow Reference

# Configuring and Using Workflows

The following sections describe how to configure and use workflows:

- Overview of RFID Workflow Technology
- Prerequisites to Configuring Workflows
- Configuring Workflows
- Example: Setting Up an Observe Portal Workflow
- Example: Setting Up a Bidirectional Portal Workflow

## Overview of RFID Workflow Technology

The WebLogic RFID Edge Server collects and filters data from RFID-labeled items moving through the supply chain, as shown in Figure 2-1. This process is carried out at the edge (remote sites) in warehouses, distribution centers, and supply rooms, and involves no business logic. However, data gathered during this process can be sent through local workflows on the Edge Server, which apply business logic to the RFID data at the edge. Data that results from this workflow processing is then sent to the organization's enterprise data center.

Figure 2-1 Workflows: Business Logic at the Edge

WebLogic RFID Edge Server lets you create custom RFID-enabled workflows easily and quickly. You construct workflows from workflow modules, which take input messages (event or programming cycle reports, or output from other modules), and emit workflow messages according to embedded business logic. There are two types of workflow modules: business logic modules (such as Bidirectional Portal or Observe Portal) that represent business processes, and helper modules (such as Stack Light) that the business logic modules call to control hardware at the edge or send messages to other systems.

The WebLogic RFID Edge Server supports the following workflow modules:

- Business Logic Modules:

- Bidirectional Portal—Used when it is necessary to carry out business logic based on the direction of detected tags. Monitors tag data traffic, detects directional item movement, and calls other modules to perform tasks based on tag direction.
- Observe Portal—Used when it is necessary to carry out business logic based on tag data traffic observations. Monitors tag data traffic across a read point and calls other modules to perform tasks based on what is read.

- Helper Modules:

- Numeric Display—Manages LED devices.
- Stack Light—Manages stack light logical devices.
- Message Notifier—Converts workflow messages to text or XML and sends them to notification destinations.

Note: | Drivers for notification destinations must be configured within the RFID Edge Server. See Installing WebLogic RFID Edge Server for detailed instructions.

Figure 2-2 shows a workflow involving the Bidirectional Portal, Stack Light, and Message Notifier modules.

Figure 2-2 Configured Workflow

The Bidirectional Portal takes input from two observation points (Side A and Side B). Based on the movement of tags between two observation points, it can determine directionality and perform business logic based on the direction of the tagged objects; in this case, operating the stack lights and sending an EPCIS event to some destination.

At a more detailed level, workflows such as the Observe Portal or Bidirectional Portal can also be viewed as a series of actions triggered by the observation of an EPC. For example, the observation of an EPC on an RFID-tagged case of consumer goods travelling down a conveyor belt could increment an LED counter, change a stack light to green, send an EPCIS event, or send a notification to another system.

Figure 2-3 shows workflows in the context of EPC data.

Figure 2-3 Workflows in Context

Any or all of these workflow-related events could be triggered by the EPC observation. In more complex cases, multiple actions of the same type could be triggered (events or notifications could be sent to multiple destinations, for example).

## Prerequisites to Configuring Workflows

Before you configure a workflow, you need to configure the ECSpec whose reports will provide input to the workflow. See Using the RFID Edge Server Administration Console for instructions on configuring an ECSpec. You must also have a working installation of the WebLogic RFID Edge Server, including one or more hardware devices (stack lights, RFID devices, and LED displays). If your workflows will send EPCIS events to the RFID Enterprise Server, you will also need a working installation of the WebLogic RFID Enterprise Server.

## Configuring Workflows

You configure workflows by configuring workflow modules and connecting them together, using the RFID Edge Server Administration Console. Workflow modules are connected to one another by referring to the name of the next module in the workflow.

### Defining a Workflow Module: Main Steps

To define a workflow module:

1. Start the RFID Edge Server Administration Console if it is not already running.
2. Select the Workflow Modules node under the Site and Edge Server you are working with.
3. Choose the type of operation to perform:

1. To define a new module, click New.
2. To create a copy of an existing module, select the module and click Clone.

4. Give the module you are creating a unique Module Name.
5. Choose the Module Type from the drop-down list.
6. Configure the workflow module by filling in values for the fields according to the information provided in Workflow Module Reference.
7. Click OK to save your changes.

### Defining a Workflow: Main Steps

To define a workflow:

1. Start the RFID Edge Server Administration Console if it is not already running.
2. Check that notification drivers are set up for all types of notifications you will be using.

These drivers are defined in the `RFID_EDGE_HOME``/etc/edge.props` file, where `RFID_EDGE_HOME` is the directory where you installed the RFID Edge Server software.

3. Configure any RFID devices you will be using.

For testing purposes, as an RFID device, you can configure the Reader Simulator software included with the RFID Edge Server.

For more information on RFID device configuration, see the RFID Reader Reference and any manufacturer documentation provided with your hardware.

4. Create the ECSpecs and associated ECReports required by this workflow.

For more information on creating ECSpecs, see Using the RFID Edge Server Administration Console.

5. Define helper workflow modules as described in steps 1-7, in Defining a Workflow Module: Main Steps.
6. Similarly, define a business logic workflow module, referring to the name of helper modules as needed to form a complete workflow.
7. Create a subscriber for each ECSpec.

1. Select `Workflow Module` for the Type field.
2. The Module field should contain `<``workflow module name``>` from `step 4`, in Defining a Workflow Module: Main Steps. For example, `WarehouseBidirectionalPortal`.

8. When you click Subscribe, the ECSpec will send ECReports to the workflow destination you specified.

Active subscriptions allow you to test that the workflow is functioning correctly, and that the Edge Server is sending messages to the configured locations and devices.

9. Test the workflow by simulating a tag observation using the Reader Simulator, or by holding a tag near the antennas on your RFID reader.

You should see evidence of workflow activity (workflow messages arriving at notification destinations and delivery of ECReports).

## Example: Setting Up an Observe Portal Workflow

The Observe Portal workflow allows you to capture data about RFID-tagged objects observed at a particular read point. These instructions describe how to set up an Observe Portal workflow. Substitute your organization's information for the example data shown here. See Workflow Module Reference for detailed field information.

To define the workflow modules:

1. Start the following components:

1. Ensure that your RFID hardware is connected and powered on or start the Reader Simulator (when it starts, de-select all EPC tags).
2. Start the WebLogic RFID Edge Server.
3. Start the Administration Console.

2. In the Administration Console, select the RFID Devices node under the Edge Server you started in step 1.
3. Configure a reader using the following Symbol Matrics AR400 configuration properties as the example.

Field | Value
--- | ---
Reader Hostname | symbolar400
Default Rate | 0
Socket Timeout | 5000
Disable Programming Cycle Check | False
Antenna 0 Logical Reader Name | ar400-1
Antenna 0 Power Level | 125
Antenna 1 Logical Reader Name | ar400-2
Antenna 1 Power Level | 125
Left Stack Light Logical Reader Name | LeftStackLight
Right Stack Light Logical Reader Name | RightStackLight
Stack Light Control Protocol | Bytestream

Note: | If you are testing workflows using the Reader Simulator instead of RFID hardware, configure a ThingMagic Mercury4 reader.

4. Select the Workflow Modules node under the Edge Server you started in step 1.
5. Click New.
6. If using an LED, create a Numeric Display workflow module called `ObservePortalNumericDisplay` and define values as follows.

You reference the Numeric Display Module Name, `ObservePortalNumericDisplay`, when configuring the Observe Portal (Numeric Display) Output Destinations, in step 9.

Field | Value
--- | ---
Device Host | localhost
Device Port | 9090
Device Connection Timeout | 5000

7. If using a Stack Light, create a Stack Light workflow module called `StackLight`.

You reference the Stack Light Module Name, `StackLight`, when configuring the Observe Portal (Stack Light) Output Destinations, in step 9.

Field | Value
--- | ---
Logical Reader Name | LeftStackLight

8. Create a Message Notifier workflow module called `ObservePortalMessageNotifier`.

You reference the Message Notifier Module Name, `ObservePortalMessageNotifier`, when configuring the Observe Portal (EPCIS) Output Destinations, in step 9.

Field | Value
--- | ---
Destination URI | console:PostbyObservePortalMessageNotifier
Message Format | xml

9. Create an Observe Portal workflow module called `ObservePortal`.

You reference the Observe Portal Module Name, `ObservePortal`, when configuring the ECSpec subscriber, in step 11.

For detailed field information, see Observe Portal Module.

Field | Value
--- | ---
Tag Addition ECReport Name | AdditionReport
EPCIS Object Event Action | OBSERVE
EPCIS Business Step URI | Receiving
EPCIS Read Point URI | urn:epc:id:sgln:004163.00020.0
EPCIS Business Location URI | urn:epc:id:sgln:004163.00018.0
(EPCIS) Output Destinations | ObservePortalMessageNotifier
Note: | This value must match the Message Notifier Module Name (in step 8). Otherwise, you will get exceptions in the Console when the workflow runs.
(Numeric Display) Display Duration | 0
Tag Deletion ECReport Name | DeletionReport
(Numeric Display) Output Destinations | ObservePortalNumericDisplay
Note: | This value must match the Numeric Display Module Name (in step 6). Otherwise, you will get exceptions in the Console when the workflow runs.
(Stack Light) Display Duration | 0
(Stack Light) Output Destinations | StackLight
Note: | This value must match the Stack Light Module Name (in step 7). Otherwise, you will get exceptions in the Console when the workflow runs.

To define the workflow:

10. Create an ECSpec with two reports whose report names match those configured in the `ObservePortal` workflow module in step 9 (AdditionReport and DeletionReport).

See Working With ECSpecs in Using the RFID Edge Server Administration Console.

Alternatively, if you are using sample data, import the XML file in the `RFID_EDGE_HOME``/samples/Workflow/ObservePortal` directory, instead of performing the following steps a-c. Perform step d.

1. Add `Reader1` and `Reader2` as the logical readers used by this ECSpec, indicating that each antenna of the Reader Simulator can pick up ObjectEvents.
2. Create and save a tag addition report.

See Working With ECSpec Reports in Using the RFID Edge Server Administration Console.

Field | Value
--- | ---
Report Name | AdditionReport
Note: | The report name must match the report name in the Observe Portal configuration (step 9) or you will get exceptions in the Console when the workflow runs.
Report Contents | Tag List
Report Set | Additions
Note: | When a tag appears for the first time in a reader field it will generate an Addition Report that will notify the registered listeners.

3. Create and save a tag deletion report.

Field | Value
--- | ---
Report Name | DeletionReport
Note: | The report name must match the report name in the Observe Portal configuration (step 9) or you will get exceptions in the Console when the workflow runs.
Report Contents | Tag List
Report Set | Deletions
Note: | The workflow only sends information about deleted tags to the Numeric Display module.

4. In the Administration Console, select File > Deploy As and name the ECSpec `ObservePortalECSpec`.

Now the Observe Portal workflow is ready to observe EPC tags. It will do so when you subscribe ECReport notification to the Observe Portal.

11. Select the `ObservePortalECSpec` ECSpec from the ECSpecs node and click New in the ECSpec Subscribers pane at the bottom of the page.

1. Create a new subscription.

Field | Value
--- | ---
Type | Workflow Module
Module | ObservePortal
Note: | The Module field must contain the ObservePortal instance name <Observe Portal Module Name> configured in step 9 or you will get exceptions in the Console when the workflow runs.

2. Click Subscribe to complete the subscription.

The subscriber is added to the ECSpec Subscribers pane.

12. Test the workflow by using the Reader Simulator to simulate a tag read (re-select the tags), or by presenting an EPC tag to the reader you configured earlier (if the ECSpec references a physical reader).

When an EPC tag is detected by a device, an ObjectEvent is sent to the configured destinations. The LED displays the EPC tag count and the stack light remains green until an error is detected. ObjectEvents are displayed in the Edge Server Console. When a tag is taken out of a reader area, the LED count decrements. If a problem is found during transmission of an ObjectEvent, the stack light displays red. No ObjectEvent is displayed in the Edge Server Console for tag removal.

For the Numeric Display module, you can also specify a host and port of the LED device to see the number of tags incremented or decremented.

## Example: Setting Up a Bidirectional Portal Workflow

The Bidirectional Portal workflow allows you to determine the movement of RFID-tagged objects from one read point to another, and to capture data about those objects. These instructions describe how to set up a Bidirectional Portal. Substitute your organization's information for the sample data shown here. See Workflow Module Reference for detailed field information.

Setting up a Bidirectional Portal workflow is very similar to setting up an Observe Portal. The primary differences are:

- You define two sets of configuration parameters, one for each read point, by configuring a Bidirectional Portal workflow module.
- You define a module for each hardware device controlled by the workflow. For example, if there is an LED by each read point, define a Numeric Display module for each one.
- You define two ECSpecs - one to provide ECReport data to the each read point.

To set up a Bidirectional Portal workflow:

1. Follow steps 1 through 5 of Example: Setting Up an Observe Portal Workflow. The remaining steps below explain how to adapt that procedure to setting up a Bidirectional Portal workflow.
2. In step 6, create two Numeric Display workflow modules with the Module Names `BidirectionalNumericDisplayPoint1` and `BidirectionalNumericDisplayPoint2`. Their Device Port properties should be set to 9191 and 9292, respectively.
3. In step 7, create two Stack Light workflow modules with the Module Names `BidirectionalStackLightPoint1` and `BidirectionalStackLightPoint2`. The Logical Reader Name properties should be set to `LeftStackLight` and `RightStackLight`, respectively (to match the logical reader names defined in the reader).
4. In step 8, create a Message Notifier workflow module with the Module Name `BidirectionalPortalMessageNotifier` as follows:

Field | Value
--- | ---
Destination URI | console:PostbyBidirectionalPortalMessageNotifier

5. In step 9, create a Bidirectional Portal workflow module called `BidirectionalPortal`.

For detailed field information, see Bidirectional Portal Module.

Field | Value
--- | ---
Object Event Output Destinations | BidirectionalPortalMessageNotifier
Note: | This value must match the Message Notifier Module Name defined in step 4.
EPCIS Read Point URI | urn:epc:id:sgln:004163.00018.0
Stale Tag Timeout | 5000

Side A:

Field | Value
--- | ---
(Side A) Tag Addition ECReport Name | AdditionReport Side A
(Side A) Tag Deletion ECReport Name | DeletionReport Side A

Side B:

Field | Value
--- | ---
(Side B) Tag Addition ECReport Name | AdditionReport Side B
(Side B) Tag Deletion ECReport Name | DeletionReport Side B

Side A to Side B:

Field | Value
--- | ---
(EPCIS) Object Event Action | OBSERVE
(EPCIS) Aggregation Event Action | OBSERVE
(EPCIS) Business Step URI | Receiving
(EPCIS) Business Location URI | urn:epc:id:sgln:004163.00030.0
(Numeric Display) Display Duration | 0
(Numeric Display) Reset Interval | 15000
(Numeric Display) Output Destinations | BidirectionalNumericDisplayPoint1
Note: | This value must match one of the Numeric Display Module Names defined in step 2.
(Stack Light) Display Duration | 5000
(Stack Light) Output Destinations | BidirectionalStackLightPoint1
Note: | This value must match one of the Stack Light Module Names defined in step 3.

Side B to Side A:

Field | Value
--- | ---
(EPCIS) Object Event Action | OBSERVE
(EPCIS) Aggregation Event Action | OBSERVE
(EPCIS) Business Step URI | Sending
(EPCIS) Business Location URI | urn:epc:id:sgln:004163.00040.0
(Numeric Display) Display Duration | 0
(Numeric Display) Reset Interval | 15000
(Numeric Display) Output Destinations | BidirectionalNumericDisplayPoint2
Note: | This value must match one of the Numeric Display Module Names defined in step 2.
(Stack Light) Display Duration | 5000
(Stack Light) Output Destinations | BidirectionalStackLightPoint2
Note: | This value must match one of the Stack Light Module Names defined in step 3.

Aggregation Data:

Field | Value
--- | ---
Control Tag EPC Patterns | urn:epc:pat:sscc-96:4.0037000.* urn:epc:pat:giai-96:4.0037000.*
Parent Tag EPC Patterns | urn:epc:pat:sscc-96:4.0037000.* urn:epc:pat:giai-96:4.0037000.*
Delay After Detecting Direction | 500
Output Destinations | BidirectionalPortalMessageNotifier
Note: | This value must match the Message Notifier Module Name defined in step 4.

6. Substitute the instructions below for step 10.

Create two ECSpecs with two reports each, whose report names match those configured in the `BidirectionalPortal` module in step 5.

See Working With ECSpecs in Using the RFID Edge Server Administration Console.

Alternatively, if you are using sample data, import the XML files in the `RFID_EDGE_HOME``/samples/Workflow/BidirectionalPortal` directory instead of performing steps a-c. Perform step d and step e.

1. Add `Reader1` as the logical reader used by the first ECSpec.
2. Create and save a tag addition report. See Working With ECSpec Reports in Using the RFID Edge Server Administration Console.

Field | Value
--- | ---
Report Name | AdditionReport Side A
Note: | The report name must match the report name in the Bidirectional Portal configuration (step 5) or you will get exceptions at the console when the workflow runs.
Report Contents | Tag List
Report Set | Additions
Note: | When a tag appears for the first time in a reader field it will generate an Addition Report that will notify registered listeners.

3. Create and save a tag deletion report.

Field | Value
--- | ---
Report Name | DeletionReport Side A
Note: | The report name must match the report name in the Bidirectional Portal configuration (step 5) or you will get exceptions at the console when the workflow runs.
Report Contents | Tag List
Report Set | Deletions
Note: | The workflow only sends information about deleted tags to the Numeric Display module.

4. In the Administration Console, select File > Deploy As and name the ECSpec `BidirectionalPortal-Point1-ECSpec`.

You have an ECSpec with two reports that are dedicated to displaying events for the Bidirectional Portal for its first read point.

5. Repeat steps a-d to create a second ECSpec named `BidirectionalPortal-Point2-ECSpec` that uses `Reader2` as the logical reader. The two ECReports will be named `AdditionReport Side B` and `DeletionReport Side B`.

7. Substitute the instructions below for step 11.

Now the Bidirectional Portal workflow is ready to observe EPC tags and discern their direction. It will do so when you subscribe ECReport notifications to the Bidirectional Portal.

1. Select `BidirectionalPortal-Point1-ECSpec` from the ECSpecs node on the Administration Console and click New in the ECSpec Subscribers pane at the bottom of the page.
2. Create a new subscription.

Field | Value
--- | ---
Type | Workflow Module
Module | BidirectionalPortal
Note: | The Module field must contain the BidirectionalPortal instance name <Bidirectional Portal Module Name> configured in step 5 or you will get exceptions in the Console when the workflow runs.

3. Click Subscribe to complete the subscription.

The subscriber is added to the ECSpec Subscribers pane.

4. Repeat steps a-c to subscribe `BidirectionalPortal-Point2-ECSpec`.

8. Test the workflow by using the Reader Simulator to simulate a tag read, or by presenting an EPC tag to the readers you configured earlier (if the ECSpec references a physical reader).

Note: | If you are using the Reader Simulator, make sure that both antennas have the same EPC tags to simulate the same tag moving from the first logical reader to the second. If the EPC tag is not exactly the same for each antenna, there will be no directional events.

Also if an Observe Portal ECSpec is using `Reader1` or `Reader2` you should suspend the ECSpec (or you will get redundant events from the Observe Portal as well as the expected directional events). This is not necessary, but it does improve readability of the Console output.

When an EPC tag is detected by `Reader1` and then by `Reader2`, a directional ObjectEvent is sent to configured destinations for that direction. In addition, the LED displays the current EPC tag count, and the stack light displays green until an error is detected. The ObjectEvent is displayed in the EdgeServer Console.