apache / plc4x

PLC4X The Industrial IoT adapter
https://plc4x.apache.org/
Apache License 2.0
1.26k stars 402 forks source link

[Feature Request][OPC-UA]: PublishRequest is required to reduce server pressure #1362

Closed zhyang-liu closed 1 week ago

zhyang-liu commented 9 months ago

What would you like to happen?

  1. it seems that SubscriptionRequestBuilder is not working properly, it aways saying "opcua.tag isn't a PlcSubscriptionTag".
  2. It seems that PublishRequest is only implemented in MSpec, but is not used.
{
    subRequest, err := connection.SubscriptionRequestBuilder().
        AddChangeOfStateTagAddress("field1", "ns=1;s=values/int64").
        Build()
    if err != nil {
        fmt.Println(fmt.Errorf("error preparing subscription-request: %s", err.Error()))
        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        // error preparing subscription-request: *opcua.tag isn't a PlcSubscriptionTag

        os.Exit(1)
    }
    subRequestResult := <-subRequest.Execute()
    if subRequestResult.GetErr() != nil {
        fmt.Println(fmt.Errorf("error executing subscription-request: %s", subRequestResult.GetErr().Error()))
        os.Exit(1)
    }
    resp := subRequestResult.GetResponse()
    fmt.Println(resp.String())
    handle, err := resp.GetSubscriptionHandle("field1")
    if err != nil {
        fmt.Println(fmt.Errorf("error getting handle: %s", err.Error()))
        os.Exit(1)
    }
    handle.Register(func(event model.PlcSubscriptionEvent) {
        fmt.Println("got event:\n", event.String())
    })
}

Programming Languages

Protocols

chrisdutz commented 9 months ago

Well ... generally the PLC4X API didn't have the concept of a Publish operation, but I have started on working on a PublishAPI extension ... so I guess that#s the reason we haven't got any publish-support yet.

splatch commented 1 week ago

Please note that golang driver is currently in fairly bad condition. It is not actively maintained and requires huge effort to get functional parity with java version. It misses 1) security handling [encryption & signing] 2) segmentation of messages 3) soon it will also miss support for event subscriptions.

I am closing this issue, as we can't do much about it for now.