new Message<JsonNode>( // "PaymentReceivedEvent", // message.get("traceId").asText(), //
@StreamListener(target = Sink.INPUT, condition="(headers['messageType']?:'')=='RetrievePaymentCommand'") @Transactional public void retrievePaymentCommandReceived(String messageJson) throws JsonParseException, JsonMappingException, IOException { Message<RetrievePaymentCommandPayload> message = new ObjectMapper().readValue(messageJson, new TypeReference<Message<RetrievePaymentCommandPayload>>(){}); RetrievePaymentCommandPayload retrievePaymentCommand = message.getPayload(); System.out.println("Retrieve payment: " + retrievePaymentCommand.getAmount() + " for " + retrievePaymentCommand.getRefId()); messageSender.send( // new Message<PaymentReceivedEventPayload>( // "PaymentReceivedEvent", // message.getTraceId(), // new PaymentReceivedEventPayload() // .setRefId(retrievePaymentCommand.getRefId())) .setCorrelationId(message.getCorrelationId())); }
@Override public void execute(DelegateExecution context) throws Exception { String traceId = context.getProcessBusinessKey(); String eventNameString = null; if (eventName!=null && eventName.getValue(context)!=null) { eventNameString = (String) eventName.getValue(context); } else { // if not configured we use the element id from the flow definition as default eventNameString = context.getCurrentActivityId(); } messageSender.send(new Message<String>( // eventNameString, // traceId, // null)); // no payload at the moment }
@Override public void execute(DelegateExecution context) throws Exception { String refId = (String) context.getVariable("refId"); String correlationId = (String) context.getVariable("correlationId"); String traceId = context.getProcessBusinessKey(); messageSender.send( // new Message<PaymentReceivedEventPayload>( // "PaymentReceivedEvent", // traceId, // new PaymentReceivedEventPayload() // .setRefId(refId)) .setCorrelationId(correlationId)); }