Closed michael-wirth closed 6 years ago
@michael-wirth can you please clarify what version of spring-cloud-stream you are using?
I installed the application bundle with the link on the spring-data-flow website -> https://bit.ly/Celsius-SR1-stream-applications-kafka-10-maven, which resolves to http-source-kafka-10-1.3.1.RELEASE
the http-app defined the follwoing dependencies: spring-cloud-stream-dependencies.version =Ditmars.SR2 spring-cloud-stream = 1.3.1-RELEASE spring-cloud-dependencies.version = Edgware.RELEASE
here's the full dependency tree:
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ http-source-kafka-10 ---
[INFO] org.springframework.cloud.stream.app:http-source-kafka-10:jar:1.3.1.RELEASE
[INFO] +- org.springframework.cloud:spring-cloud-starter-config:jar:1.4.0.RELEASE:compile
[INFO] | +- org.springframework.cloud:spring-cloud-starter:jar:1.3.0.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter:jar:1.5.9.RELEASE:compile
[INFO] | | | \- org.yaml:snakeyaml:jar:1.17:runtime
[INFO] | | +- org.springframework.cloud:spring-cloud-context:jar:1.3.0.RELEASE:compile
[INFO] | | | \- org.springframework.security:spring-security-crypto:jar:4.2.3.RELEASE:compile
[INFO] | | +- org.springframework.cloud:spring-cloud-commons:jar:1.3.0.RELEASE:compile
[INFO] | | | \- org.apache.httpcomponents:httpclient:jar:4.5.3:compile
[INFO] | | | \- org.apache.httpcomponents:httpcore:jar:4.4.8:compile
[INFO] | | \- org.springframework.security:spring-security-rsa:jar:1.0.3.RELEASE:compile
[INFO] | | \- org.bouncycastle:bcpkix-jdk15on:jar:1.55:compile
[INFO] | | \- org.bouncycastle:bcprov-jdk15on:jar:1.55:compile
[INFO] | +- org.springframework.cloud:spring-cloud-config-client:jar:1.4.0.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.9.RELEASE:compile
[INFO] | | +- org.springframework:spring-web:jar:4.3.13.RELEASE:compile
[INFO] | | | +- org.springframework:spring-beans:jar:4.3.13.RELEASE:compile
[INFO] | | | \- org.springframework:spring-context:jar:4.3.13.RELEASE:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-databind:jar:2.8.10:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.8.10:compile
[INFO] +- org.springframework.cloud:spring-cloud-starter-stream-kafka:jar:1.3.1.RELEASE:compile
[INFO] | \- org.springframework.cloud:spring-cloud-stream-binder-kafka:jar:1.3.1.RELEASE:compile
[INFO] | +- org.springframework.cloud:spring-cloud-stream-binder-kafka-core:jar:1.3.1.RELEASE:compile
[INFO] | | \- org.springframework.integration:spring-integration-kafka:jar:2.1.2.RELEASE:compile
[INFO] | +- org.springframework.cloud:spring-cloud-stream-codec:jar:1.3.1.RELEASE:compile
[INFO] | | \- com.esotericsoftware:kryo-shaded:jar:3.0.3:compile
[INFO] | | \- com.esotericsoftware:minlog:jar:1.3.0:compile
[INFO] | +- org.apache.kafka:kafka_2.11:jar:0.10.1.1:compile
[INFO] | | +- net.sf.jopt-simple:jopt-simple:jar:4.9:compile
[INFO] | | +- com.yammer.metrics:metrics-core:jar:2.2.0:compile
[INFO] | | +- org.scala-lang:scala-library:jar:2.11.8:compile
[INFO] | | +- com.101tec:zkclient:jar:0.9:compile
[INFO] | | +- org.apache.zookeeper:zookeeper:jar:3.4.8:compile
[INFO] | | | \- io.netty:netty:jar:3.7.0.Final:compile
[INFO] | | \- org.scala-lang.modules:scala-parser-combinators_2.11:jar:1.0.4:compile
[INFO] | +- org.apache.kafka:kafka-clients:jar:0.10.1.1:compile
[INFO] | | +- net.jpountz.lz4:lz4:jar:1.3.0:compile
[INFO] | | \- org.xerial.snappy:snappy-java:jar:1.1.2.6:compile
[INFO] | \- org.springframework.kafka:spring-kafka:jar:1.1.7.RELEASE:compile
[INFO] +- org.springframework.cloud.stream.app:spring-cloud-starter-stream-source-http:jar:1.3.1.RELEASE:compile
[INFO] | +- org.springframework.integration:spring-integration-http:jar:4.3.12.RELEASE:compile
[INFO] | | +- org.springframework.integration:spring-integration-core:jar:4.3.12.RELEASE:compile
[INFO] | | | \- org.springframework:spring-tx:jar:4.3.13.RELEASE:compile
[INFO] | | \- org.springframework:spring-webmvc:jar:4.3.13.RELEASE:compile
[INFO] | | \- org.springframework:spring-expression:jar:4.3.13.RELEASE:compile
[INFO] | +- org.springframework.integration:spring-integration-java-dsl:jar:1.2.3.RELEASE:compile
[INFO] | | \- org.reactivestreams:reactive-streams:jar:1.0.0:compile
[INFO] | +- org.springframework.cloud:spring-cloud-stream:jar:1.3.1.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-actuator:jar:1.5.9.RELEASE:compile
[INFO] | | | \- org.springframework.boot:spring-boot-actuator:jar:1.5.9.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-web:jar:1.5.9.RELEASE:compile
[INFO] | | | +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.5.9.RELEASE:compile
[INFO] | | | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.23:compile
[INFO] | | | | | \- org.apache.tomcat:tomcat-annotations-api:jar:8.5.23:compile
[INFO] | | | | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.23:compile
[INFO] | | | \- org.hibernate:hibernate-validator:jar:5.3.6.Final:compile
[INFO] | | | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | | | +- org.jboss.logging:jboss-logging:jar:3.3.1.Final:compile
[INFO] | | | \- com.fasterxml:classmate:jar:1.3.4:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-validation:jar:1.5.9.RELEASE:compile
[INFO] | | | \- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.23:compile
[INFO] | | +- org.springframework:spring-messaging:jar:4.3.13.RELEASE:compile
[INFO] | | +- org.springframework.integration:spring-integration-jmx:jar:4.3.12.RELEASE:compile
[INFO] | | +- org.springframework:spring-tuple:jar:1.0.0.RELEASE:compile
[INFO] | | +- org.springframework.integration:spring-integration-tuple:jar:1.0.0.RELEASE:compile
[INFO] | | \- org.springframework.retry:spring-retry:jar:1.2.1.RELEASE:compile
[INFO] | +- org.springframework.cloud:spring-cloud-stream-metrics:jar:1.3.1.RELEASE:compile
[INFO] | +- com.jayway.jsonpath:json-path:jar:2.2.0:compile
[INFO] | | +- net.minidev:json-smart:jar:2.2.1:compile
[INFO] | | | \- net.minidev:accessors-smart:jar:1.1:compile
[INFO] | | | \- org.ow2.asm:asm:jar:5.0.3:compile
[INFO] | | \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] | +- org.springframework.integration:spring-integration-xml:jar:4.3.12.RELEASE:compile
[INFO] | | +- org.springframework:spring-oxm:jar:4.3.13.RELEASE:compile
[INFO] | | \- org.springframework.ws:spring-xml:jar:2.3.0.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-logging:jar:1.5.9.RELEASE:compile
[INFO] | | +- ch.qos.logback:logback-classic:jar:1.1.11:compile
[INFO] | | | \- ch.qos.logback:logback-core:jar:1.1.11:compile
[INFO] | | +- org.slf4j:jcl-over-slf4j:jar:1.7.25:compile
[INFO] | | +- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
[INFO] | | \- org.slf4j:log4j-over-slf4j:jar:1.7.25:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-security:jar:1.5.9.RELEASE:compile
[INFO] | | +- org.springframework:spring-aop:jar:4.3.13.RELEASE:compile
[INFO] | | +- org.springframework.security:spring-security-config:jar:4.2.3.RELEASE:compile
[INFO] | | | \- org.springframework.security:spring-security-core:jar:4.2.3.RELEASE:compile
[INFO] | | \- org.springframework.security:spring-security-web:jar:4.2.3.RELEASE:compile
[INFO] | \- io.pivotal.spring.cloud:spring-cloud-services-starter-config-client:jar:1.5.0.RELEASE:compile
[INFO] | +- org.springframework.security.oauth:spring-security-oauth2:jar:2.0.14.RELEASE:runtime
[INFO] | | +- commons-codec:commons-codec:jar:1.10:compile
[INFO] | | \- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:runtime
[INFO] | | \- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:runtime
[INFO] | +- io.pivotal.spring.cloud:spring-cloud-services-cloudfoundry-connector:jar:1.5.0.RELEASE:compile
[INFO] | | +- io.pivotal.spring.cloud:spring-cloud-services-connector-core:jar:1.5.0.RELEASE:compile
[INFO] | | | \- org.springframework.cloud:spring-cloud-core:jar:1.2.5.RELEASE:compile
[INFO] | | \- org.springframework.cloud:spring-cloud-cloudfoundry-connector:jar:1.2.5.RELEASE:compile
[INFO] | +- io.pivotal.spring.cloud:spring-cloud-services-spring-connector:jar:1.5.0.RELEASE:compile
[INFO] | | +- org.projectlombok:lombok:jar:1.16.18:compile
[INFO] | | \- org.springframework.cloud:spring-cloud-spring-service-connector:jar:1.2.5.RELEASE:compile
[INFO] | \- io.pivotal.spring.cloud:cloudfoundry-certificate-truster:jar:1.0.1.RELEASE:compile
[INFO] \- org.springframework.boot:spring-boot-starter-test:jar:1.5.9.RELEASE:test
[INFO] +- org.springframework.boot:spring-boot-test:jar:1.5.9.RELEASE:test
[INFO] | \- org.springframework.boot:spring-boot:jar:1.5.9.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.5.9.RELEASE:test
[INFO] +- junit:junit:jar:4.12:test
[INFO] +- org.assertj:assertj-core:jar:2.6.0:test
[INFO] +- org.mockito:mockito-core:jar:1.10.19:test
[INFO] | \- org.objenesis:objenesis:jar:2.1:compile
[INFO] +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] +- org.skyscreamer:jsonassert:jar:1.4.0:test
[INFO] | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] +- org.springframework:spring-core:jar:4.3.13.RELEASE:compile
[INFO] \- org.springframework:spring-test:jar:4.3.13.RELEASE:test
Michael, you are indeed working off very old release. Please consider 2.0.0.RELEASE The reason being is that content-type and type conversion is one of the main themes of the entire release so a lot of work went into simplifying it and making it more consistent. Also, see this blog and this section of the new user guide.
Thanks for the update.
"Old release"? Yes, I was running it on Spring Cloud DataFlow and version 1.3.1 was the current release back in February.
The http-source send wrong Content-Type because the JavaClassMimeTypeUtils does only match with application/json
http-source sets/converts Content-Type to application/json;charset=UTF-8 https://github.com/spring-projects/spring-framework/blob/master/spring-web/src/main/java/org/springframework/http/server/ServletServerHttpRequest.java#L170
but the JavaClassMimeTypeUtils does check for application/json https://github.com/spring-cloud/spring-cloud-stream/blob/master/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/JavaClassMimeTypeUtils.java#L50
Steps to reproduce:
check kafka channel "output" -> contentType has changed to
text/plain
\FFcontentType\00\00\00"text/plain"originalContentType\00\00\00 "application/json;charset=UTF-8"{}