OPC DA component for Apache Camel
This component for allows connections to OPC DA. For OPC UA you can use camel-milo
which
is available in Apache Camel starting with version 2.19.0.
This work is based on the OpenSCADA Utgard project: ibh-systems/org.openscada.
The endpoint URI is utgard:host?user=username&password=password&classId=01234567-89AB-CDEF-0123-4567890ABCDE&itemId=OPC.Item.ID
Note: The URI must be used with the “class id” (aka “clsId”). It is not possible to use
the “prog id”.
The following additional parameters may be used:
Note: Currently the component only supports consuming data from OPC DA (aka reading).
The message consists of the body and headers, following the classic Apache Camel approach. The body will
contain the main OPC item state.
An instance of the OPCITEMSTATE
as defined here: OPCITEMSTATE.java.
The main value is a JIVariant
, which is a representation of the COM Variant
in Java. You can see its definition here: JIVariant.java.
Currently the following headers are provided:
Name | Description |
---|---|
utgard.itemId | The OPC item ID |
Install the DP using the Kura Package Manager:
This will extend the embedded Camel runtime to provide the utgard
endpoint. You can now either
drop in your own Camel application bundle or use the pre-installed “Camel XML Router” to drop in
a set of Camel XML route definitions (also see example below).
The following XML route definition subscribes to an OPC DA server
<routes xmlns="http://camel.apache.org/schema/spring">
<route id="route1">
<from uri="utgard:192.168.122.72?user=opc&password=opc1234&classId=F8582CF2-88FB-11D0-B850-00C0F0104305&itemId=Triangle Waves.Int4"></from>
<setBody><simple>Value: ${body.value.object}, Timestamp: ${body.timestamp.asCalendar().getTime()}</simple></setBody>
<to uri="stream:out"></to>
</route>
</routes>