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

How to Subscribe for events #288

Closed
ddobric opened this issue Apr 18, 2020 · 4 comments
Closed

How to Subscribe for events #288

ddobric opened this issue Apr 18, 2020 · 4 comments

Comments

@ddobric
Copy link
Contributor

ddobric commented Apr 18, 2020

Looking for an example which demonstrates how to subscribe events.
The provided Client sample shows how to publish an event, but there is not way in the DaprClient to receive events.

Especially looking for PUB/SUB concepts like retries, peek-and-lock, peek-and-delete,..
This is all requirement on the concrete component, but do not see anything in the spec related to such concepts.
PUB/SUB building block is definitely extremely important , but common brokers support many integration patterns and features related to them. My question is how to deal with them in dapr.
Publishing an event and receiving t is very basic operation, which will not satisfy most of common enterprise requirements.

Thanks in advance

@amanbha
Copy link
Contributor

amanbha commented Apr 18, 2020

For subscribing to events please see, https://github.com/dapr/docs/blob/master/reference/api/pubsub_api.md#required-application-user-code-routes

If you are using aspnetcore, then you can use the aspnetcore samples to subscribe to events which adds a route for the topics as well.

Dapr building block provides abstraction over multiple components so full fledged functionality is not available, however components allow extending this functionality by providing metadata on requests/response.

For specific scenarios in pub/sub building block, please open issue in dapr runtime repo or discuss it in our gitter channel https://gitter.im/Dapr/community

@ddobric
Copy link
Contributor Author

ddobric commented Apr 22, 2020

Thanks for your feedback @amanbha .
I guess we are missing a method in DaprClientSdk to subscribe for events or similar.

For example:

var eventReader = client.SubscribeAsync()

@amanbha
Copy link
Contributor

amanbha commented Apr 22, 2020

Subscribed events are discovered by Dapr by calling on to http://localhost:<appPort>/dapr/subscribe endpoint to discover subscribed topics. DaprClientSDK provides methods to call into Dapr and doesnt start a web server, so route has to be configured in user app. If Aspnet core integration with dapr is used then topics can be subscribed as shown in the Routing sample and the aspnetcore integration will configure the correct routes. https://github.com/dapr/dotnet-sdk/tree/master/samples/AspNetCore/RoutingSample

@amanbha amanbha closed this as completed May 4, 2020
@tommorvolloriddle
Copy link

Hello @amanbha
I have a similar problem at receiving end, I have is a c++ monolith application and needs dapr for pub-sub, if I am unable to run dapr side-by-side to c++ application (as the application bootstraps with some scripts) and have no way for declaring call backs (with HTTP verb attributed methods) will I be still able to subscribe to messages, Just for your information: I am using RabbitMQ for messaging

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

No branches or pull requests

3 participants