Java Event Handler Naming Convention

I struggled with this and cannot find a good deal to designate event handlers. I have a project (spring integration) in which there is an inbound channel adapter listening on various types of events. Received events are sent to the router, which then publishes it to the channel (another channel for each type of event). We have a service activator that listens on these channels, which then consume these events.

This is the naming convention we have now ... For example, the ORDER_CREATED event is posted to a channel named "order-created-channel". At the other end of the channel, we have a service activator named OrderCreatedEventHandler. OrderCreatedEventHandler sends a notification to the buyer for whom the order is being created. Thus, event handlers are called depending on the type of event they consume / process, and not on the activity they perform. But now I have a problem ... I want to change the channel created by the order to the publication subscription channel, and I want 2 activators of the service to listen on it. One of the activists of the service must send a notice to the buyer, and the other - create an invoice for this order.

So that made me think ... Do I have to prevent these service activators from ending the word "EventHandlers"? Should I call them the activities they perform? Is there a naming convention for channels and beans that handle events?

+4
source share
1 answer

There is no general naming convention; it is up to your organization.

My only general recommendation is to provide endpoints id(instead of excluding and resolving the frame name to the endpoint). In addition, it is up to you.

0
source

Source: https://habr.com/ru/post/1583853/


All Articles