Not able to forward msg in "Kafka Message Start Event Connector" to downstream component

Hello Everyone,
I am trying to receive a Kafka message and forward it to the next REST call later. Though, I can see that the Kafka connector is getting the msg but some how the variables that I am setting in “Result Expression” are not showing up in the next REST Connector or in the Operate console.

I can’t upload images or BPMN file, since its company laptop. Bit of imagination required.

So in Kafka connector’s Output mappingResult Variable section I have declared “response” as Result Variable Name and in Result Expression, I have something like below.

{
   customername:value.customername, 
   dob:value.dob, 
   mobilenumber: value.mobilenumber, 
   emailid: value.emailid, 
   postcode: value.postcode
}

In the next REST Outbound Connector, I declared Request Payload something like below.

{
    "customername" : customername,
    "dob" : dob,
    "mobilenumber" : mobilenumber,
    "emailid" : emailid,
    "postcode" : postcode
}

In Operate window, I do see incoming msg to Kafka connector like below.

{
"rawValue":"{ customername='John Doe', dob='1990-05-15', mobilenumber='1234567890', emailid='john.doe@example.com', postcode='12345'}",
"value":"{ customername='John Doe', dob='1990-05-15', mobilenumber='1234567890', emailid='john.doe@example.com', postcode='12345'}"
}

But when my REST Endpoint (SpringBoot Code) is receiving JSON, all the attributes are null

What am I doing wrong?

Can anyone please help!!

Regards,
Jaikrat

Hi @jaikrat.singh

I didn’t have the chance to try Kafka connector but as per the docs, value is a field of response variable so try the following Result expression

{
   customername: response.value.customername, 
   dob: response.value.dob, 
   mobilenumber: response.value.mobilenumber, 
   emailid: response.value.emailid, 
   postcode: response.value.postcode
}

Thanks for your reply @hassang but unfortunately it didn’t work.

I even tried

{
   customername: response.**rawValue**.customername, 
   dob: response.**rawValue**.dob, 
   mobilenumber: response.**rawValue**.mobilenumber, 
   emailid: response.**rawValue**.emailid, 
   postcode: response.**rawValue**.postcode
}

But the REST Connector is getting below.

{"mobilenumber":null,"dob":null,"postcode":null,"emailid":null,"customername":null}

Thanks again.

Hi @jaikrat.singh

In Operate, can you view the response variable after the Kafka connector step has finished executing? If so, what does it contain?

Hello @hassang ,
Its

{
"rawValue":"{ customername='John Doe', dob='1990-05-15', mobilenumber='1234567890', emailid='john.doe@example.com', postcode='12345'}",
"value":"{ customername='John Doe', dob='1990-05-15', mobilenumber='1234567890', emailid='john.doe@example.com', postcode='12345'}"
}

Thanks
Jaikrat

Its resolved @hassang and everyone.
I was making a silly mistake in my producer code. The JSON string was not correct. There was nothing wrong with Caumnda Kafka connector configs etc.

At last I had

{
   customername: value.customername, 
   dob: value.dob, 
   mobilenumber: value.mobilenumber, 
   emailid: value.emailid, 
   postcode: value.postcode
}

All good. Thank you. :+1:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.