davsclaus commented on code in PR #28896:
URL: https://github.com/apache/camel/pull/28896#discussion_r4447259687
##########
components/camel-camunda/src/main/java/org/apache/camel/component/camunda/processor/ProcessProcessor.java:
##########
@@ -32,23 +31,20 @@ public ProcessProcessor(CamundaEndpoint endpoint) {
public void process(Exchange exchange) throws Exception {
ProcessRequest message = null;
- if (exchange.getMessage().getBody() instanceof ProcessRequest) {
- message = exchange.getMessage().getBody(ProcessRequest.class);
- } else if (exchange.getMessage().getBody() instanceof ProcessResponse)
{
+ Object body = exchange.getMessage().getBody();
+ if (body instanceof ProcessRequest) {
+ message = (ProcessRequest) body;
+ } else if (body instanceof ProcessResponse) {
+ ProcessResponse response = (ProcessResponse) body;
message = new ProcessRequest();
- message.setProcessInstanceKey(((ProcessResponse)
exchange.getMessage().getBody()).getProcessInstanceKey());
- message.setProcessId(((ProcessResponse)
exchange.getMessage().getBody()).getProcessId());
- message.setProcessVersion(((ProcessResponse)
exchange.getMessage().getBody()).getProcessVersion());
- message.setProcessKey(((ProcessResponse)
exchange.getMessage().getBody()).getProcessKey());
- } else if (exchange.getMessage().getBody() instanceof String) {
- try {
- String bodyString =
exchange.getMessage().getBody(String.class);
-
- message = objectMapper.readValue(bodyString,
ProcessRequest.class);
- } catch (JsonProcessingException jsonProcessingException) {
- throw new IllegalArgumentException("Cannot convert body to
ProcessMessage", jsonProcessingException);
- }
- } else {
+ message.setProcessInstanceKey(response.getProcessInstanceKey());
+ message.setProcessId(response.getProcessId());
+ message.setProcessVersion(response.getProcessVersion());
+ message.setProcessKey(response.getProcessKey());
+ } else if (body != null) {
+ message = readJson(exchange, ProcessRequest.class, "Cannot convert
body to ProcessMessage");
Review Comment:
Fixed in 9b47d29f8e43: the message now says `ProcessRequest`.
_Claude Code on behalf of Claus Ibsen (davsclaus)_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]