@Test public void testNewFlowButNotHandled() { Event<Payload> event = new Event<>(payload); event.setKey("KEY"); underTest.accept(event); verify(flowConfigurationMap, times(1)).get(anyString()); verify(runningFlows, never()).put(any(Flow.class), isNull(String.class)); verify(flowLogService, never()).save(any(FlowParameters.class), anyString(), anyString(), any(Payload.class), anyMap(), any(), any(FlowState.class)); }
@Override public void accept(Event<? extends Payload> event) { String key = (String) event.getKey(); Payload payload = event.getData(); String flowId = getFlowId(event); String flowChainId = getFlowChainId(event); String flowTriggerUserCrn = getFlowTriggerUserCrn(event); Span activeSpan = tracer.activeSpan(); SpanContext spanContext = event.getHeaders().get(FlowConstants.SPAN_CONTEXT); String operationName = event.getKey().toString(); if (FlowTracingUtil.isActiveSpanReusable(activeSpan, spanContext, operationName)) { LOGGER.debug("Reusing existing span. {}", activeSpan.context()); doAccept(event, key, payload, flowId, flowChainId, flowTriggerUserCrn, spanContext); } else { Span span = FlowTracingUtil.getSpan(tracer, operationName, spanContext, flowId, flowChainId, flowTriggerUserCrn); spanContext = FlowTracingUtil.useOrCreateSpanContext(spanContext, span); try (Scope ignored = tracer.activateSpan(span)) { doAccept(event, key, payload, flowId, flowChainId, flowTriggerUserCrn, spanContext); } finally { span.finish(); } } }
Flow2Handler implements Consumer<Event<? extends Payload>> { @Override public void accept(Event<? extends Payload> event) { String key = (String) event.getKey(); Payload payload = event.getData(); String flowId = getFlowId(event); String flowChainId = getFlowChainId(event); String flowTriggerUserCrn = getFlowTriggerUserCrn(event); Span activeSpan = tracer.activeSpan(); SpanContext spanContext = event.getHeaders().get(FlowConstants.SPAN_CONTEXT); String operationName = event.getKey().toString(); if (FlowTracingUtil.isActiveSpanReusable(activeSpan, spanContext, operationName)) { LOGGER.debug("Reusing existing span. {}", activeSpan.context()); doAccept(event, key, payload, flowId, flowChainId, flowTriggerUserCrn, spanContext); } else { Span span = FlowTracingUtil.getSpan(tracer, operationName, spanContext, flowId, flowChainId, flowTriggerUserCrn); spanContext = FlowTracingUtil.useOrCreateSpanContext(spanContext, span); try (Scope ignored = tracer.activateSpan(span)) { doAccept(event, key, payload, flowId, flowChainId, flowTriggerUserCrn, spanContext); } finally { span.finish(); } } } }
Flow2Handler implements Consumer<Event<? extends Payload>> { @Override public void accept(Event<? extends Payload> event) { String key = (String) event.getKey(); Payload payload = event.getData(); String flowId = getFlowId(event); String flowChainId = getFlowChainId(event); String flowTriggerUserCrn = getFlowTriggerUserCrn(event); Span activeSpan = tracer.activeSpan(); SpanContext spanContext = event.getHeaders().get(FlowConstants.SPAN_CONTEXT); String operationName = event.getKey().toString(); if (FlowTracingUtil.isActiveSpanReusable(activeSpan, spanContext, operationName)) { LOGGER.debug("Reusing existing span. {}", activeSpan.context()); doAccept(event, key, payload, flowId, flowChainId, flowTriggerUserCrn, spanContext); } else { Span span = FlowTracingUtil.getSpan(tracer, operationName, spanContext, flowId, flowChainId, flowTriggerUserCrn); spanContext = FlowTracingUtil.useOrCreateSpanContext(spanContext, span); try (Scope ignored = tracer.activateSpan(span)) { doAccept(event, key, payload, flowId, flowChainId, flowTriggerUserCrn, spanContext); } finally { span.finish(); } } }  }
Flow2Handler implements Consumer<Event<? extends Payload>> { @Override public void accept(Event<? extends Payload> event) { String key = (String) event.getKey(); Payload payload = event.getData(); String flowId = getFlowId(event); String flowChainId = getFlowChainId(event); String flowTriggerUserCrn = getFlowTriggerUserCrn(event); Span activeSpan = tracer.activeSpan(); SpanContext spanContext = event.getHeaders().get(FlowConstants.SPAN_CONTEXT); String operationName = event.getKey().toString(); if (FlowTracingUtil.isActiveSpanReusable(activeSpan, spanContext, operationName)) { LOGGER.debug("Reusing existing span. {}", activeSpan.context()); doAccept(event, key, payload, flowId, flowChainId, flowTriggerUserCrn, spanContext); } else { Span span = FlowTracingUtil.getSpan(tracer, operationName, spanContext, flowId, flowChainId, flowTriggerUserCrn); spanContext = FlowTracingUtil.useOrCreateSpanContext(spanContext, span); try (Scope ignored = tracer.activateSpan(span)) { doAccept(event, key, payload, flowId, flowChainId, flowTriggerUserCrn, spanContext); } finally { span.finish(); } } }  @Override void accept(Event<? extends Payload> event); void cancelFlow(Long stackId, String flowId); void restartFlow(String flowId); void restartFlow(FlowLog flowLog); }
Flow2Handler implements Consumer<Event<? extends Payload>> { @Override public void accept(Event<? extends Payload> event) { String key = (String) event.getKey(); Payload payload = event.getData(); String flowId = getFlowId(event); String flowChainId = getFlowChainId(event); String flowTriggerUserCrn = getFlowTriggerUserCrn(event); Span activeSpan = tracer.activeSpan(); SpanContext spanContext = event.getHeaders().get(FlowConstants.SPAN_CONTEXT); String operationName = event.getKey().toString(); if (FlowTracingUtil.isActiveSpanReusable(activeSpan, spanContext, operationName)) { LOGGER.debug("Reusing existing span. {}", activeSpan.context()); doAccept(event, key, payload, flowId, flowChainId, flowTriggerUserCrn, spanContext); } else { Span span = FlowTracingUtil.getSpan(tracer, operationName, spanContext, flowId, flowChainId, flowTriggerUserCrn); spanContext = FlowTracingUtil.useOrCreateSpanContext(spanContext, span); try (Scope ignored = tracer.activateSpan(span)) { doAccept(event, key, payload, flowId, flowChainId, flowTriggerUserCrn, spanContext); } finally { span.finish(); } } }  @Override void accept(Event<? extends Payload> event); void cancelFlow(Long stackId, String flowId); void restartFlow(String flowId); void restartFlow(FlowLog flowLog); static final String FLOW_ID; static final String FLOW_CHAIN_ID; static final String FLOW_FINAL; static final String FLOW_CANCEL; }