ctron / de.dentrassi.camel.milo

This component is now available in Camel 2.19.0
https://camel.apache.org
Apache License 2.0
7 stars 6 forks source link

Should the camel endpoint support different parameter types? #5

Closed gbrost closed 7 years ago

gbrost commented 7 years ago

Hi,

i have a working route now that subscribes on a node id. We achieved this by changing our model to string based node IDs. However, OPC-UA supports both NumericNodeId and StringNodeId. The Endpoint automatically converts the node parameter to string. It would be very helpful if the endpoint would support both types.

Thanks!

ctron commented 7 years ago

I think that we could actually take the full syntax in addition: s=foobar and i=1234, …

gbrost commented 7 years ago

That would be perfect!

ctron commented 7 years ago

I made a few updates and it should be possible to use the "node" parameter now, which uses the full format string e.g. nsu=urn:my:namespace;s=item-id. Of course this has to be escaped or wrapped with the RAW(…) construct of Camel.

ctron commented 7 years ago

It would be great if you could give it a try. However you will also need to update Milo to the newest SNAPSHOT.

gbrost commented 7 years ago

I tried it out. My route not looks like this: <from uri="milo-client:tcp://0.0.0.0:4840/freeopcua/server?samplingInterval=100000&amp;?node=RAW(nsu=http://examples.freeopcua.github.io;s=2)"/> But now i got a "connection refused" error. I did not change my server, but maybe some changes broke compatibility?

2016-12-13 13:37:50,051 | INFO | ua-shared-pool-4 | opctorest | 40 - org.apache.camel.camel-core - 2.18.0 | Triggered Route: opctorest, requesting node 2: Sensorreading body: DataValue{value=Variant{value=69.20000000000034}, status=StatusCode{name=Good, value=0x00000000, quality=good}, sourceTime=DateTime{utcTime=131261062696508100, javaDate=Tue Dec 13 13:37:49 CET 2016}, serverTime=DateTime{utcTime=131261062696508230, javaDate=Tue Dec 13 13:37:49 CET 2016}} 2016-12-13 13:37:50,054 | INFO | ua-shared-pool-4 | HttpMethodDirector | 253 - org.apache.servicemix.bundles.commons-httpclient - 3.1.0.7 | I/O exception (java.net.ConnectException) caught when processing request: Connection refused (Connection refused) 2016-12-13 13:37:50,055 | INFO | ua-shared-pool-4 | HttpMethodDirector | 253 - org.apache.servicemix.bundles.commons-httpclient - 3.1.0.7 | Retrying request 2016-12-13 13:37:50,056 | INFO | ua-shared-pool-4 | HttpMethodDirector | 253 - org.apache.servicemix.bundles.commons-httpclient - 3.1.0.7 | I/O exception (java.net.ConnectException) caught when processing request: Connection refused (Connection refused) 2016-12-13 13:37:50,057 | INFO | ua-shared-pool-4 | HttpMethodDirector | 253 - org.apache.servicemix.bundles.commons-httpclient - 3.1.0.7 | Retrying request 2016-12-13 13:37:50,057 | INFO | ua-shared-pool-4 | HttpMethodDirector | 253 - org.apache.servicemix.bundles.commons-httpclient - 3.1.0.7 | I/O exception (java.net.ConnectException) caught when processing request: Connection refused (Connection refused) 2016-12-13 13:37:50,058 | INFO | ua-shared-pool-4 | HttpMethodDirector | 253 - org.apache.servicemix.bundles.commons-httpclient - 3.1.0.7 | Retrying request 2016-12-13 13:37:50,067 | ERROR | ua-shared-pool-4 | DefaultErrorHandler | 40 - org.apache.camel.camel-core - 2.18.0 | Failed delivery for (MessageId: ID-ubuntu-dev-42949-1481632052412-1-1223 on ExchangeId: ID-ubuntu-dev-42949-1481632052412-1-1224). Exhausted after delivery attempt: 1 caught: java.net.ConnectException: Connection refused (Connection refused)

Message History

RouteId ProcessorId Processor Elapsed (ms) [opctorest ] [opctorest ] [milo-client://tcp://0.0.0.0:4840/freeopcua/server?%3Fnode=RAW(nsu=http://examp] [ 17] [opctorest ] [log1 ] [log ] [ 1] [opctorest ] [setHeader1 ] [setHeader[CamelHttpMethod] ] [ 0] [opctorest ] [convertBodyTo1 ] [convertBodyTo[java.lang.String] ] [ 0] [opctorest ] [to1 ] [http://localhost:8080/sensordataapp/sensordataelements/addraw ] [ 8]

Stacktrace

java.net.ConnectException: Connection refused (Connection refused) at java.net.PlainSocketImpl.socketConnect(Native Method)[:1.8.0_111] at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)[:1.8.0_111] at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)[:1.8.0_111] at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)[:1.8.0_111] at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)[:1.8.0_111] at java.net.Socket.connect(Socket.java:589)[:1.8.0_111] at java.net.Socket.connect(Socket.java:538)[:1.8.0_111] at java.net.Socket.(Socket.java:434)[:1.8.0_111] at java.net.Socket.(Socket.java:286)[:1.8.0_111] at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80)[253:org.apache.servicemix.bundles.commons-httpclient:3.1.0.7] at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:122)[253:org.apache.servicemix.bundles.commons-httpclient:3.1.0.7] at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)[253:org.apache.servicemix.bundles.commons-httpclient:3.1.0.7] at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)[253:org.apache.servicemix.bundles.commons-httpclient:3.1.0.7] at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)[253:org.apache.servicemix.bundles.commons-httpclient:3.1.0.7] at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)[253:org.apache.servicemix.bundles.commons-httpclient:3.1.0.7] at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)[253:org.apache.servicemix.bundles.commons-httpclient:3.1.0.7] at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)[253:org.apache.servicemix.bundles.commons-httpclient:3.1.0.7] at org.apache.camel.component.http.HttpProducer.executeMethod(HttpProducer.java:257)[300:org.apache.camel.camel-http:2.18.0] at org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:152)[300:org.apache.camel.camel-http:2.18.0] at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[40:org.apache.camel.camel-core:2.18.0] at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)[40:org.apache.camel.camel-core:2.18.0] at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[40:org.apache.camel.camel-core:2.18.0] at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)[40:org.apache.camel.camel-core:2.18.0] at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)[40:org.apache.camel.camel-core:2.18.0] at org.apache.camel.processor.Pipeline.process(Pipeline.java:120)[40:org.apache.camel.camel-core:2.18.0] at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)[40:org.apache.camel.camel-core:2.18.0] at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)[40:org.apache.camel.camel-core:2.18.0] at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:97)[40:org.apache.camel.camel-core:2.18.0] at org.apache.camel.component.milo.client.MiloClientConsumer.handleValueUpdate(MiloClientConsumer.java:74)[158:de.dentrassi.camel.milo.camel-milo:0.1.0.SNAPSHOT] at org.eclipse.milo.opcua.sdk.client.subscriptions.OpcUaMonitoredItem.lambda$setValueConsumer$0(OpcUaMonitoredItem.java:107)[150:org.eclipse.milo.sdk-client:0.1.0.SNAPSHOT] at org.eclipse.milo.opcua.sdk.client.subscriptions.OpcUaMonitoredItem.onValueArrived(OpcUaMonitoredItem.java:147)[150:org.eclipse.milo.sdk-client:0.1.0.SNAPSHOT] at org.eclipse.milo.opcua.sdk.client.subscriptions.OpcUaSubscriptionManager.lambda$null$28(OpcUaSubscriptionManager.java:529)[150:org.eclipse.milo.sdk-client:0.1.0.SNAPSHOT] at org.eclipse.milo.opcua.stack.core.util.ExecutionQueue$PollAndExecute.run(ExecutionQueue.java:107)[154:org.eclipse.milo.stack-core:0.1.0.SNAPSHOT] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_111] at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_111] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_111] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_111] at java.lang.Thread.run(Thread.java:745)[:1.8.0_111] 2016-12-13 13:37:51,059 | INFO | ua-shared-pool-4 | opctorest | 40 -

ctron commented 7 years ago

Hm, strange. There shouldn't be any different to the code handling the port number.

What looks a bit strange to me is the address you are using: 0.0.0.0, could that be a mistake?

gbrost commented 7 years ago

The address looks a bit weird, but worked all the time. It is from some example and just remained there. I changed it to 127.0.0.1, but it still produces a connection refused. Maybe some milo functionality was added that enforces an authenticated connection or the like? I use https://github.com/FreeOpcUa/python-opcua as a server. The related client (https://github.com/FreeOpcUa/opcua-client-gui) still works fine.

From: Jens Reimann [mailto:notifications@github.com] Sent: Dienstag, 13. Dezember 2016 14:16 To: ctron/de.dentrassi.camel.milo de.dentrassi.camel.milo@noreply.github.com Cc: Brost, Gerd gerd.brost@aisec.fraunhofer.de; Author author@noreply.github.com Subject: Re: [ctron/de.dentrassi.camel.milo] Should the camel endpoint support different parameter types? (#5)

Hm, strange. There shouldn't be any different to the code handling the port number.

What looks a bit strange to me is the address you are using: 0.0.0.0, could that be a mistake?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ctron/de.dentrassi.camel.milo/issues/5#issuecomment-266735544, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHB-ilViBgRcdxaKm8hSxkg69UNNyawiks5rHpqZgaJpZM4LFJV8.

ctron commented 7 years ago

No it can't be related to authentication since you do get "connection refused", which is in the TCP layer.

Can you confirm that the port is open?

gbrost commented 7 years ago

Ok, this is embarassing. My route depends on another service (where it sends the data) and that services was broken. I checked again and restarted it, now everything works fine!

Thanks you very much!

ctron commented 7 years ago

Cool! .. Glad it wasn't me :wink:

Thanks for reporting!

gbrost commented 7 years ago

Thanks for being so responsive. Your camel endpoint really helps a lot ☺ Cheers Gerd

From: Jens Reimann [mailto:notifications@github.com] Sent: Mittwoch, 14. Dezember 2016 10:49 To: ctron/de.dentrassi.camel.milo de.dentrassi.camel.milo@noreply.github.com Cc: Brost, Gerd gerd.brost@aisec.fraunhofer.de; State change state_change@noreply.github.com Subject: Re: [ctron/de.dentrassi.camel.milo] Should the camel endpoint support different parameter types? (#5)

Cool! .. Glad it wasn't me 😉

Thanks for reporting!

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/ctron/de.dentrassi.camel.milo/issues/5#issuecomment-266990384, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHB-ih4BVMBK5KsE61CkMY8VV2cnP5MGks5rH7ucgaJpZM4LFJV8.