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

Improvement of sending event to Audit Service #1407

Closed
daisuke-yoshimoto opened this issue Aug 17, 2017 · 1 comment

Comments

@daisuke-yoshimoto
Copy link
Member

commented Aug 17, 2017

Changing sending method as follows.

  • Before: sending events each time an event is generated(ActivitiEventListener)
  • After : sending events when the command is closed(CommandContextCloseListener).

https://github.com/Activiti/Activiti/blob/master/activiti-services/activiti-services-events/src/main/java/org/activiti/services/events/MessageProducerActivitiEventListener.java

Background

Improvement of network communication frequency

  • If sending events each time an event is generated, the number of times of network communication will very increase.
    • For example, when 100 variables are updated, at least 100 network communications occur.

Transaction consistency

  • The data of Audit Service is committed for each event.
  • However, if an error occurs during the command, Process Engine data is rolled back and Audit Service data is not rolled back.
@daisuke-yoshimoto daisuke-yoshimoto self-assigned this Aug 17, 2017
@daisuke-yoshimoto daisuke-yoshimoto added this to the 08-2017 milestone Aug 17, 2017
@daisuke-yoshimoto daisuke-yoshimoto added bug and removed bug labels Aug 17, 2017
@erdemedeiros erdemedeiros added this to Open in Activiti 7.x Aug 17, 2017
@salaboy salaboy moved this from Open to In Progress in Activiti 7.x Aug 18, 2017
@daisuke-yoshimoto daisuke-yoshimoto moved this from In Progress to Review in Activiti 7.x Aug 22, 2017
@salaboy

This comment has been minimized.

Copy link
Contributor

commented Aug 22, 2017

@daisuke-yoshimoto ok I want to understand more about this. I do understand that events will be sent even if the state of the process engine is rolled back in the case of an issue. So basically, you are sending all the events when the transaction is committed, am I right? In principle, I do agree with that idea, but we need to be careful on how we implement this. In my opinion, we can solve this by making all the process interactions with external entities async by default. Meaning that we will assume that BPMN events and Sequence Flows will not fail so transactions will be small and will not cause big rollbacks. In the example of (start event) -> (service task) - > (user task) -> (end event) we will force the engine to deal with the first service task in an async way always, so the first transaction will only include the start event + scheduling the service task. Which means also that you are right in bundling several events together in the same message, because even that simple example has two events happening together in the same tx.

Does this make sense?

@erdemedeiros erdemedeiros moved this from Review to Closed in Activiti 7.x Aug 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Activiti 7.x
  
Closed
3 participants
You can’t perform that action at this time.