开发者

Design pattern for Processing unlimited Events

开发者 https://www.devze.com 2022-12-19 13:38 出处:网络
I want suggestion any design pattern in which I want to process unlimited events. I am not sure how many events I may get when the system is running.

I want suggestion any design pattern in which I want to process unlimited events.

I am not sure how many events I may get when the system is running. I have some actions defined on those events.

I am looking for so开发者_C百科lutions which can give me processing actions in near real time.


Does Chain of Responsibility work for you?

You would give all the event producers an object to send the events to, and that object would pass the event down from rule to rule until it is fully handled.

Also when building GUI applications in Java I need to deal with many graphical components which generate various events based on user actions, and based on what event happens I need to implement rules for what happens.

I am not sure the name of the basic event listener pattern that is in use in Swing, but that might work for you too.

If you mean real time like GUI response time, then just calling out to an event handler should be plenty fast, that is what happens in Swing.

If I knew more about how or where these events are being generated then there may be a better pattern that I could suggest.

0

精彩评论

暂无评论...
验证码 换一张
取 消