[
https://issues.apache.org/jira/browse/PLC4X-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17630935#comment-17630935
]
Lukas Ott commented on PLC4X-292:
---------------------------------
This issue has been migrated to https://github.com/apache/plc4x/issues/612
> Reading data from PLC via Modbus with Camel using timer
> -------------------------------------------------------
>
> Key: PLC4X-292
> URL: https://issues.apache.org/jira/browse/PLC4X-292
> Project: Apache PLC4X
> Issue Type: Wish
> Components: Integration-Camel
> Affects Versions: 0.8.0
> Reporter: Dmitry Shagiakhmetov
> Priority: Major
>
> I want to get data from plc with period = 1 ms. I try it using consumer:
> {code:java}
> val modbusConsumerEndpoint = Plc4XEndpoint(modbusEndpointUri,
> plcComponent).apply {
> tags = mapOf(fieldName to "input-register:$plcInputPort")
> period = 1
> }
> from(modbusConsumerEndpoint)
> .process {
> it.message.body = (it.message.body as Map<String,
> Any>)[ModbusEndpointParams.fieldName]
> it.setMainBody(ctx)
> }
> .marshal().json()
> .setHeader(KafkaConstants.KEY, constant(""))
> .to(mainKafkaEndpoint){code}
> But I have only one loop. {color:#000000}*Plc4XConsumer* may work with
> trigger, but I couldn't find any examples for that.
> {color}
> {color:#000000}Either I try to use camel chain with timer:{color}
> {code:java}
> from("timer:foo?period=1")
> .process {
> it.message.body =
> mapOf(fieldName to "input-register:$plcInputPort")
> }
> .to("plc4x:modbus://uri"){code}
> But *Plc4XProducer* works only for writting. I solve this problem by creating
> own Endpoint with custom Producer includes ReadRequestBuilder extendÂ
> Plc4XEndpoint and Plc4XProducer. It looks not like production decision.
> What is a right way to do this task?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)