Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis Dapr sample #2109

Closed
xky0007 opened this issue Nov 15, 2023 · 5 comments
Closed

Redis Dapr sample #2109

xky0007 opened this issue Nov 15, 2023 · 5 comments
Assignees
Labels
feature request New feature or request
Milestone

Comments

@xky0007
Copy link

xky0007 commented Nov 15, 2023

Describe the bug
When using dapr with redis, it cannot publish data out.

To Reproduce
Steps to reproduce the behavior:

  1. Set opc-publisher-service in docker compose file
  opc-publisher-test:
    container_name: "opc-publisher-test"
    image: mcr.microsoft.com/iotedge/opc-publisher:2.9.2
    environment:
    - PublishedNodesFile=/appdata/publisher/pn.json
    - DaprConnectionString="PubSubComponent=redis-pubsub-cloud;HttpPort=7001;"
    - DefaultTransport=Dapr
    - MessagingMode=PubSub
    - LogLevel=Debug

    network_mode: "host"
    volumes:
    - ./data/opc-publisher-1:/appdata/publisher
    
publisher-dapr:
    image: "daprio/daprd:edge"
    command: [
      "./daprd",
      "-app-id","opc-publisher-test",
      #"-placement-host-address", "localhost:50006",
      "-components-path","/components",
      #"--app-protocol","http",
      "--dapr-http-port","7001",
      #"--app-port","7000"
    ]
    network_mode: "host"

    volumes:
      - "./dapr:/components"
    depends_on:
      - opc-publisher-test
  1. dapr configuration
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: redis-pubsub-cloud
  namespace: default
spec:
  type: pubsub.redis
  version: v1
  metadata:
  - name: redisHost
    value: localhost:6379
  - name: redisPassword
    value: ""

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
image

opc-publisher-test                           | [08:45:03.7398] dbug: Azure.IIoT.OpcUa.Publisher.Stack.Services.OpcUaSubscription[0]
opc-publisher-test                           |       Keep alive for subscription opc.tcp://localhost:4844_346F0688_TCN-A1234J4321:TCN-A1234J4321-data:10 with sequenceNumber 2, publishTime 11/15/2023 08:45:03.
opc-publisher-test                           | [08:45:09.4540] dbug: Azure.IIoT.OpcUa.Publisher.Services.NetworkMessageSink[0]
opc-publisher-test                           |       #98: Error 'The value cannot be null or empty (Parameter 'pubsubName')' during sending network message. Retrying in 00:00:09.8000000...
opc-publisher-test                           |       System.ArgumentException: The value cannot be null or empty (Parameter 'pubsubName')
opc-publisher-test                           |          at Furly.Extensions.Dapr.Clients.DaprPubSubClient.DaprPubSubEvent.SendAsync(CancellationToken ct)
opc-publisher-test                           |          at Azure.IIoT.OpcUa.Publisher.Services.NetworkMessageSink.SendAsync(ValueTuple`2 message) in /home/vsts/work/1/s/src/Azure.IIoT.OpcUa.Publisher/src/Services/NetworkMessageSink.cs:line 276

Desktop (please complete the following information):

  • OS: win 11 - wsl 2 - ubuntu 22.04
@marcschier marcschier self-assigned this Nov 15, 2023
@marcschier marcschier added the bug Something isn't working label Nov 15, 2023
@marcschier marcschier added this to the 2.9.3 milestone Nov 15, 2023
@xky0007 xky0007 changed the title Cannot publish vid Dapr sidecar Cannot publish via Dapr sidecar Nov 16, 2023
@marcschier
Copy link
Collaborator

I cannot reproduce this. I can add above and see the options pubsubname filled and added during SendAsync. But if pubsubname or storename are not configued the clients should not be added to DI. And then produce the above errors due to the missing ocnfiguration. I will fix the latter.

@marcschier marcschier added feature request New feature or request and removed bug Something isn't working labels Nov 18, 2023
@marcschier marcschier changed the title Cannot publish via Dapr sidecar Redid Dapr sample Nov 18, 2023
@marcschier marcschier changed the title Redid Dapr sample Redis Dapr sample Nov 18, 2023
@xky0007
Copy link
Author

xky0007 commented Nov 20, 2023

I cannot reproduce this. I can add above and see the options pubsubname filled and added during SendAsync. But if pubsubname or storename are not configued the clients should not be added to DI. And then produce the above errors due to the missing ocnfiguration. I will fix the latter.

Can you share your configuration? I only set pubsub config as I don't need store state function. Or are these two components are madatory?

Thanks.

@marcschier
Copy link
Collaborator

Store is not required, but store client would be added regardless in 2.9.2 even if you do not set the store component. This is fixed in 2.9.3.

Would you mind trying above with "2.9.3-preview3" tag of publisher? When you do, please strip the semicolon at the end of the connection string. (I will fix that also, so that it is not required, but without the port is not parsed as integer).

@xky0007
Copy link
Author

xky0007 commented Nov 20, 2023

Store is not required, but store client would be added regardless in 2.9.2 even if you do not set the store component. This is fixed in 2.9.3.

Would you mind trying above with "2.9.3-preview3" tag of publisher? When you do, please strip the semicolon at the end of the connection string. (I will fix that also, so that it is not required, but without the port is not parsed as integer).

I checked the source code and found the dapr only works for GRPC protocol in current setting. After enable GRPC port for dapr, it works. I will close this and create a new issue.

Thanks.

@xky0007 xky0007 closed this as completed Nov 20, 2023
@xky0007
Copy link
Author

xky0007 commented Nov 20, 2023

I'll leave it open. Please feel free to close it when you finish the example or you don't need to track this issue.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants