You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@plc4x.apache.org by "helloworld121 (via GitHub)" <gi...@apache.org> on 2025/09/10 08:56:37 UTC
[D] Subscribe OPC/UA Node
GitHub user helloworld121 created a discussion: Subscribe OPC/UA Node
Hi there,
I’m working on an OPC UA subscription to a specific node. I already implemented this using Eclipse Milo, but now I want to switch to Apache Camel and use PLC4X. I’m struggling with the migration :(
The OPC UA server namespace is: ns=1;s=server1
Nodes:
Trigger node: server1.Trigger
Value node 1: server1.Value1
Value node 2: server1.Value2
The goal is: Subscribe to the trigger node and, whenever it changes, read the values of server1.Value1 and server1.Value2.
Using Apache Camel, I created a route like this:
`
public class CamelPlc4xIntegrationTest {
public static void main(String[] args) throws Exception {
CamelContext context = new DefaultCamelContext();
context.addRoutes(new RouteBuilder() {
@Override
public void configure() {
String endpoint =
"plc4x:opcua:tcp://127.0.0.1:12686" +
"?discovery=false" +
"&period=1000" +
"&tags=myValue:ns=2;s=server1.Trigger";
from(endpoint)
.log("Raw Body: ${body}");
}
});
context.start();
Thread.sleep(60_000);
context.stop();
}
}
`
However, I’m not receiving any data from the endpoint even tho the trigger changed. Now I am a little bit lost.
Could someone help me identify what I’m missing or doing wrong? Many thanks!
GitHub link: https://github.com/apache/plc4x/discussions/2253
----
This is an automatically sent email for dev@plc4x.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@plc4x.apache.org
Re: [D] Subscribe OPC/UA Node
Posted by "helloworld121 (via GitHub)" <gi...@apache.org>.
GitHub user helloworld121 edited a discussion: Subscribe OPC/UA Node
Hi there,
I’m working on an OPC UA subscription to a specific node. I already implemented this using Eclipse Milo, but now I want to switch to Apache Camel and use PLC4X. I’m struggling with the migration :(
The OPC UA server namespace is: ns=1;s=server1
Nodes:
Trigger node: server1.Trigger
Value node 1: server1.Value1
Value node 2: server1.Value2
The goal is: Subscribe to the trigger node and, whenever it changes, read the values of server1.Value1 and server1.Value2.
Using Apache Camel, I created a route like this:
```java
public class CamelPlc4xIntegrationTest {
public static void main(String[] args) throws Exception {
CamelContext context = new DefaultCamelContext();
context.addRoutes(new RouteBuilder() {
@Override
public void configure() {
String endpoint =
"plc4x:opcua:tcp://127.0.0.1:12686" +
"?discovery=false" +
"&period=1000" +
"&tags=myValue:ns=2;s=server1.Trigger";
from(endpoint)
.log("Raw Body: ${body}");
}
});
context.start();
Thread.sleep(60_000);
context.stop();
}
}
```
However, I’m not receiving any data from the endpoint even tho the trigger changed. Now I am a little bit lost.
Could someone help me identify what I’m missing or doing wrong? Many thanks!
GitHub link: https://github.com/apache/plc4x/discussions/2253
----
This is an automatically sent email for dev@plc4x.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@plc4x.apache.org
Re: [D] Subscribe OPC/UA Node
Posted by "helloworld121 (via GitHub)" <gi...@apache.org>.
GitHub user helloworld121 edited a discussion: Subscribe OPC/UA Node
Hi there,
I’m working on an OPC UA subscription to a specific node. I already implemented this using Eclipse Milo, but now I want to switch to Apache Camel and use PLC4X. I’m struggling with the migration :(
The OPC UA server namespace is: ns=1;s=server1
Nodes:
Trigger node: server1.Trigger
Value node 1: server1.Value1
Value node 2: server1.Value2
The goal is: Subscribe to the trigger node and, whenever it changes, read the values of server1.Value1 and server1.Value2.
Using Apache Camel, I created a route like this:
```
public class CamelPlc4xIntegrationTest {
public static void main(String[] args) throws Exception {
CamelContext context = new DefaultCamelContext();
context.addRoutes(new RouteBuilder() {
@Override
public void configure() {
String endpoint =
"plc4x:opcua:tcp://127.0.0.1:12686" +
"?discovery=false" +
"&period=1000" +
"&tags=myValue:ns=2;s=server1.Trigger";
from(endpoint)
.log("Raw Body: ${body}");
}
});
context.start();
Thread.sleep(60_000);
context.stop();
}
}
```
However, I’m not receiving any data from the endpoint even tho the trigger changed. Now I am a little bit lost.
Could someone help me identify what I’m missing or doing wrong? Many thanks!
GitHub link: https://github.com/apache/plc4x/discussions/2253
----
This is an automatically sent email for dev@plc4x.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@plc4x.apache.org
Re: [D] Subscribe OPC/UA Node
Posted by "sruehl (via GitHub)" <gi...@apache.org>.
GitHub user sruehl added a comment to the discussion: Subscribe OPC/UA Node
probably related to https://github.com/apache/plc4x/pull/2251
GitHub link: https://github.com/apache/plc4x/discussions/2253#discussioncomment-14360549
----
This is an automatically sent email for dev@plc4x.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@plc4x.apache.org
Re: [D] Subscribe OPC/UA Node
Posted by "splatch (via GitHub)" <gi...@apache.org>.
GitHub user splatch added a comment to the discussion: Subscribe OPC/UA Node
From OPC UA point (as far I know) there is no difference what you wish to do with subscribed values. My memory is bit blurry but there are two modes of subscriptions - cyclic and event. In your case, I believe it would be better to model (on device end) whole thing as an event, cause then your subscriber will receive a complete picture in trigger fashion.
With cyclic subscription you will need to do detection of trigger tag changes.
GitHub link: https://github.com/apache/plc4x/discussions/2253#discussioncomment-14374776
----
This is an automatically sent email for dev@plc4x.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@plc4x.apache.org