{"action":"created","issue":{"url":"https://api.github.com/repos/spring-projects/spring-integration-kafka/issues/69","labels_url":"https://api.github.com/repos/spring-projects/spring-integration-kafka/issues/69/labels{/name}","comments_url":"https://api.github.com/repos/spring-projects/spring-integration-kafka/issues/69/comments","events_url":"https://api.github.com/repos/spring-projects/spring-integration-kafka/issues/69/events","html_url":"https://github.com/spring-projects/spring-integration-kafka/issues/69","id":109676908,"number":69,"title":"Invalid characters sent at the beginning of message","user":{"login":"utmishra","id":1212811,"avatar_url":"https://avatars.githubusercontent.com/u/1212811?v=3","gravatar_id":"","url":"https://api.github.com/users/utmishra","html_url":"https://github.com/utmishra","followers_url":"https://api.github.com/users/utmishra/followers","following_url":"https://api.github.com/users/utmishra/following{/other_user}","gists_url":"https://api.github.com/users/utmishra/gists{/gist_id}","starred_url":"https://api.github.com/users/utmishra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/utmishra/subscriptions","organizations_url":"https://api.github.com/users/utmishra/orgs","repos_url":"https://api.github.com/users/utmishra/repos","events_url":"https://api.github.com/users/utmishra/events{/privacy}","received_events_url":"https://api.github.com/users/utmishra/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-10-04T11:59:44Z","updated_at":"2015-11-04T22:56:10Z","closed_at":null,"body":"Using following code, I send Elasticsearch documents for indexing. I tried converting basic Objects to JSON and sent via producer. However, every message (as checked from the console) appends jibberish characters like - *��t�{\"productId\":2455*\r\n\r\n\tpublic boolean sendMessage()\r\n\t{\r\n\t\tPageRequest page = new PageRequest(0, 1); \r\n\t\tProduct p = product.findByName(\"Cream\", page).getContent().get(0);\r\n\t\tString json = \"\";\r\n\t\tObjectMapper mapper = new ObjectMapper();\r\n\t\ttry {\r\n\t\t\tjson = mapper.writeValueAsString(p);\r\n\t\t} catch (JsonProcessingException e1) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te1.printStackTrace();\r\n\t\t}\t\t\r\n\t\tlogger.info(\"JSON = \" + json);\r\n\t\t\r\n\t\tboolean status =  inputToKafka.send(org.springframework.integration.support.MessageBuilder.withPayload(json).build());\r\n\t    try {\r\n\t        Thread.sleep(10000);\r\n\t    } catch (InterruptedException e) {\r\n\t        e.printStackTrace();\r\n\t    }\r\n\t    return status;\r\n\t}\r\n\r\nOutbound configuration\r\n\r\n     <?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n    <beans xmlns=\"http://www.springframework.org/schema/beans\"\r\n           xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n           xmlns:int=\"http://www.springframework.org/schema/integration\"\r\n           xmlns:int-kafka=\"http://www.springframework.org/schema/integration/kafka\"\r\n           xmlns:task=\"http://www.springframework.org/schema/task\"\r\n           xsi:schemaLocation=\"http://www.springframework.org/schema/integration/kafka http://www.springframework.org/schema/integration/kafka/spring-integration-kafka.xsd\r\n    \t\thttp://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd\r\n    \t\thttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd\r\n    \t\thttp://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd\">\r\n    \r\n        <int:channel id=\"inputToKafka\">\r\n            <int:queue/>\r\n        </int:channel>\r\n    \r\n        <int-kafka:outbound-channel-adapter\r\n                id=\"kafkaOutboundChannelAdapter\"\r\n                kafka-producer-context-ref=\"kafkaProducerContext\"\r\n                channel=\"inputToKafka\">\r\n            <int:poller fixed-delay=\"1000\" time-unit=\"MILLISECONDS\" receive-timeout=\"0\" task-executor=\"taskExecutor\"/>\r\n        </int-kafka:outbound-channel-adapter>\r\n    \r\n        <task:executor id=\"taskExecutor\" pool-size=\"5\" keep-alive=\"120\" queue-capacity=\"500\"/>\r\n    \r\n        <int-kafka:producer-context id=\"kafkaProducerContext\">\r\n            <int-kafka:producer-configurations>\r\n                <int-kafka:producer-configuration broker-list=\"localhost:9092\"\r\n                                                  topic=\"shopo_topic\"\r\n                                                  compression-codec=\"default\"/>\r\n            </int-kafka:producer-configurations>\r\n        </int-kafka:producer-context>\r\n    \r\n    \t</beans>\r\n\r\nAny clue ?"},"comment":{"url":"https://api.github.com/repos/spring-projects/spring-integration-kafka/issues/comments/153896025","html_url":"https://github.com/spring-projects/spring-integration-kafka/issues/69#issuecomment-153896025","issue_url":"https://api.github.com/repos/spring-projects/spring-integration-kafka/issues/69","id":153896025,"user":{"login":"kamrar","id":5478883,"avatar_url":"https://avatars.githubusercontent.com/u/5478883?v=3","gravatar_id":"","url":"https://api.github.com/users/kamrar","html_url":"https://github.com/kamrar","followers_url":"https://api.github.com/users/kamrar/followers","following_url":"https://api.github.com/users/kamrar/following{/other_user}","gists_url":"https://api.github.com/users/kamrar/gists{/gist_id}","starred_url":"https://api.github.com/users/kamrar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kamrar/subscriptions","organizations_url":"https://api.github.com/users/kamrar/orgs","repos_url":"https://api.github.com/users/kamrar/repos","events_url":"https://api.github.com/users/kamrar/events{/privacy}","received_events_url":"https://api.github.com/users/kamrar/received_events","type":"User","site_admin":false},"created_at":"2015-11-04T22:56:10Z","updated_at":"2015-11-04T22:56:10Z","body":"done, I just used value-class-type=\"java.lang.String\" and it is working."}}