@@ -23,9 +23,13 @@ public static DomainEventContext getInstance() {
2323 return instance ;
2424 }
2525
26- private void push (IEvent event , boolean sync ) {
26+ private void push (IEvent event , boolean sync , boolean hasLoopEvent ) {
2727 if (context != null ) {
2828 String traceId = EventTraceContext .getInstance ().getOrCreateTrace ();
29+ if (hasLoopEvent ){
30+ EventTraceContext .getInstance ().clearTrace ();
31+ traceId = EventTraceContext .getInstance ().getOrCreateTrace ();
32+ }
2933 EventTraceContext .getInstance ().addEvent (traceId ,event );
3034 context .publishEvent (new DomainEvent (event , sync ,traceId ));
3135 }
@@ -36,13 +40,13 @@ private void push(IEvent event, boolean sync) {
3640 * @see EventPusher
3741 * 默认 同步事件
3842 */
39- public void push (IEvent event ) {
43+ public void push (IEvent event , boolean hasLoopEvent ) {
4044 if (event instanceof IAsyncEvent ) {
41- this .push (event , false );
45+ this .push (event , false , hasLoopEvent );
4246 } else if (event instanceof ISyncEvent ) {
43- this .push (event , true );
47+ this .push (event , true , hasLoopEvent );
4448 } else {
45- this .push (event , true );
49+ this .push (event , true , hasLoopEvent );
4650 }
4751 }
4852
0 commit comments