0

We are sending the message to kinesis stream from the spring-integration application but while consuming the message via @StreamListener from the kinesis binder application we are getting the special characters like "�� t foo". please find below the code snippet and let me know is there any additional things we have to consider?

Sending message to Kinesis

Message<String> message = MessageBuilder.withPayload("foo")
            .setHeader(AwsHeaders.STREAM, TEST_STREAM)
            .setHeader("content-type","text/plain;charset=UTF-8")
            .build();
    kinesisSendChannel.send(message);

receiving Message

Charset UTF8 = Charset.forName("UTF-8");
byte[] bytes = (byte[]) message.getPayload();
String reverted = new String(bytes, UTF8);
  • Your question isn't clear. You can't send from the `KinesisMessageDrivenChannelAdapter`. That is for consuming. The JMS subject is somehow misleading. Would be great to have some simple application to play from our side. – Artem Bilan Mar 13 '18 at 17:10
  • I have simplified/corrected my question, Can you please check now – siddendara Mar 14 '18 at 01:30
  • Well, I can guess what’s going on, but I don’t want to abuse. Would be great to understand what is that `kinesisSendChannel` subscriber? How does your `@StreamListener` look? We can’t help with so little info. Absolutely unclear how to reproduce. That’s not so hard to go http://start.spring.io/ and generate simple Spring Cloud Stream app to let us to see your problem – Artem Bilan Mar 14 '18 at 02:26
  • See similar question: https://stackoverflow.com/questions/49284437/spring-cloud-stream-special-chars-in-message-received-from-kinesis – Artem Bilan Mar 14 '18 at 18:49

0 Answers0