分布式事件处理 [英] Distributed Event Processing

查看:242
本文介绍了分布式事件处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,这可能是一个noob的问题,但我似乎找不到适合的解决方案为以下用例:



在后端我们具有跨VM的x个服务数量,每个服务提供相同的服务(分布式复制)。这些服务都在监听分布式事件总线(如Hazelcast)。



当事件到达时,说GetDataA,EventBus基础架构将事件发送到每个后台终端服务一次一个。如果一个服务决定要处理它所做的事件,并通过EventBus将数据返回给事件发布者。



一旦服务决定其处理事件,则EventBus应该停止向其他侦听器(服务)发送该事件,并继续路由下一个事件(即它应该是非阻塞的)



所以这个解决方案需要一种异步运行的请求/响应分布式事件架构。



<有谁知道任何可扩展的解决方案在这个空间。我看过Hazelcast,但是事件机制意味着所有的听众都会得到这个事件。我查看了Executor服务,但是这会将代码发送到其他节点,而我正在寻找的是另一个单个节点来处理请求。

解决方案

您可以使用Hazelcast IExecutorService执行此操作。对您的任务将如何发送有细粒度控制




  • 发送给所有成员


  • 发送给任何成员(不在乎哪一个)

  • 发送给特定成员

  • 发送给拥有特定分区的成员。



还有一个选项可以使用未来和如果您不想阻止,您可以将未来与异步回调机制相结合。并且执行者不会将代码发送到节点;代码(字节码)已经存在。所以你只是发送数据。



另一个选项是创建一个点对点解决方案,如果您不想通知所有人,而只是特定的成员。这可以使用IQueue。


完成

Hi this might be a bit of a noob question, but I can't seem to find an appropriate solution for the following use case:

On the backend we have x number of services distributed across VMs, each providing the same service (distributed replication). These services are all listening on a distributed event bus (such as Hazelcast).

When an event arrives, say GetDataA, the EventBus infrastructure sends the event to each of the back end services one at a time. If a service decides its going to process the event it does so and returns the data to the publisher of the event via the EventBus.

Once a service decides its going to process an event, then the EventBus should stop sending that event to other listeners (services), and continue routing the next event (i.e. it should be non-blocking)

So this solution requires a kind of request/response distributed event architecture running asynchronously.

Does anyone know of any scalable solutions in this space. I've looked at Hazelcast, but the event mechanism means that all listeners will get the event. I've looked at the Executor service, but this sends code to other nodes, while what I am looking for is for another single node to process the request.

解决方案

You can do this with the Hazelcast IExecutorService. There is fine grained control on how your task is going to be send

  • send to all members
  • send to a subset of members
  • send to any member (don't care which one)
  • send to a particular member
  • send to a member that owns a particular partition.

There is also an option to use a future and you can combine the future with an async callback mechanism if you don't want to block. And the executor will not send code to a node; the code (bytecode) is already there. So you are just sending data.

Another option is to create a point to point solution if you don't want to notify everyone, but only specific member. This can be done using the IQueue.

这篇关于分布式事件处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆