Closed shaisha05 closed 2 weeks ago
Can you provide more information on what you're trying to achieve, your configurations and the expected result?
I updated my original comment. please have a look.
Hi @yaron2, is any further info required?
cc @greenie-msft
it may be good to add a resiliency example to the dapr/quickstarts repo for pub/sub.
@shaisha05 Im not sure I completely understand the issue but one thing I noticed is that you haven't specified the direction for which the policy should be applied. The pubsub API supports two directions - outbound and inbound. If you want to apply the policy for when an exception occurs when delivering a message, you need to add the inbound direction.
See here for more details on component directions: https://docs.dapr.io/operations/resiliency/targets/#components
@shaisha05 just checking in - did @greenie-msft's suggestion help?
@shaisha05 just checking in - did @greenie-msft's suggestion help?
No, I tried with inbound and also outbound. But did not work.
apiVersion: dapr.io/v1alpha1 kind: Resiliency metadata: name: myresiliency scopes:
spec: policies: retries: pubsubRetry: policy: constant duration: 5s maxRetries: 5
targets:
components:
orderpubsub:
# retry: pubsubRetry
inbound:
retry: pubsubRetry
@shaisha05, I don't see anything immediately wrong with your Resiliency CRD resource. @yaron2, do you?
That said, I don't think this is a docs issue. The Resiliency feature is language agnostic so the examples referenced here should be enough: https://docs.dapr.io/operations/resiliency/resiliency-overview/
If you are having trouble getting this policy to work, can you please ask in the Dapr discord for guidance? https://discord.com/invite/ptHhX6jc34
@shaisha05 - Are you still stuck on this? Any update you could provide?
@shaisha05 - Are you still stuck on this? Any update you could provide?
Yes, could not figure it out. I am not actively working on this for now. Hence, I haven't asked this on discord yet.
Since this is not a docs issue, I'm going to close this issue for now. Thanks!
I am working on a poc. For which, I started testing DAPR features with the quickstart code provided at https://github.com/dapr/quickstarts/tree/master/pub_sub/javascript/sdk. This pubsub example does not include resiliency. I added below resiliency.yaml to resources folder.
Using RabbitMQ as message broker. DAPR is setup locally with docker.
apiVersion: dapr.io/v1alpha1 kind: Resiliency metadata: name: myresiliency scopes:
spec: policies: retries: pubsubRetry: policy: constant duration: 5s maxRetries: 5
targets:
components: orderpubsub: retry: pubsubRetry
As per logs resilienycy policy is applied. But if i throw some error at subscriber as below.
server.pubsub.subscribe(pubSubName, pubSubTopic, (data, headers) =>{
if(data.orderId == 1){ console.log("Subscriber error: " + JSON.stringify(data)); throw new Error("Faulty msg"); }else{ console.log("Subscriber received: " + JSON.stringify(data)); } });
For orderId = 1, It fails and throws error. But retry is not working.
Also, I want to know how can I control retries with below.
Retry works with the
But It retries for infinitely without any interval. Is there any parameter to control max retries and duration?