micro / go-micro

A Go microservices framework
https://go-micro.dev
Apache License 2.0
21.81k stars 2.34k forks source link

v5 event package #2728

Open hunyadvari-peter opened 1 month ago

hunyadvari-peter commented 1 month ago

The event package has been deleted in v5 branch. Is there any plan to do this? How can we replace the event handling? Brokers have much less functionality, and in theory no guarantee of delivery.

asim commented 1 month ago

I think the two interfaces had a lot of overlapping concerns. So we could add some of that to the broker. Can you detail what parts you'd like to include?

hunyadvari-peter commented 1 month ago

I agree with you, but the two interfaces had different purposes. Broker = pub/sub, event = event streaming with multiple policies. Options what is missing from broker: AckWait time.Duration RetryLimit int AutoAck bool CustomRetries bool ...

From message the Ack,Nack functions.

And the most important think is to handle topic filtering, with the broker is not possible. Eg.: unable to subscribe to topic.*

asim commented 1 month ago

What's your ideal solution? Reintroduce the event interface?

asim commented 1 month ago

If you need it. You can make a PR to bring it back.

vtolstov commented 1 month ago

Broker can do all the things, auto ack is simple if defer func() { if err == nil { return evt.Ack() } or can be handled in broker implementation. Topic filtering not the problem - in kafka for example you can subscribe via regexp to topics

hunyadvari-peter commented 1 month ago

Topic filtering not the problem - in kafka for example you can subscribe via regexp to topics

We will bring a solution in PR

autoack

It is not a good solution in some situation.

Topic filtering not the problem - in kafka for example you can subscribe via regexp to topics

I do not know nothing about kafka, but a lot of event broker use a and similar character for filtering in a topic name. But rpcserver and the router try to find subscriber with the topic name he got from the broker, which is the full topic name, not the filtered. eg.: we subscribe to this: topic.customer we got event from this topic: topic.customer_micro

But we will bring a solution for this "problem" too, in PR.

vtolstov commented 1 month ago

ah =) in my fork i'm remove ability to subscribe via server package and use broker directly, with ability to unmarshal to needed struct pointer