These are chat archives for spring-cloud/spring-cloud

22nd
Apr 2016
Kharkovskyi Oleksandr
@okharkovskyi
Apr 22 2016 07:31
Then the only thing every service needs is to link it with discovery :)
discovery:
  image: progrium/consul
  command: -server -bootstrap
  ports:
    - 8400:8400
    - 8500:8500
    - 8600:8600

user-service:
  build: ./user-service
  links:
    - discovery
Jose Armesto
@fiunchinho
Apr 22 2016 11:14
@okharkovskyi you can also have a shared docker network, instead of linking the containers, so if you have several spring cloud apps, they can all use this network and you don’t need to repeat the discovery part on your docker-compose files
Kharkovskyi Oleksandr
@okharkovskyi
Apr 22 2016 12:46
@fiunchinho but will I be able to run multiply containers on the same port?
tlachy
@tlachy
Apr 22 2016 13:22
@spencergibb @dsyer Hello. In spring-cloud-commons-1.1.0.M3 was LoadBalancerAutoConfiguration.java which created RestTemplate bean. But in spring-cloud-commons-1.1.0.RC3 that bean creation was removed. Is it supposed to be like that? Where is that bean supoused to be created now? thx
Marcin Grzejszczak
@marcingrzejszczak
Apr 22 2016 13:25
the user should create the @LoadBalanced RestTemplate himself if he wants to use it
@tlachy ^^
Donovan Muller
@donovanmuller
Apr 22 2016 14:33

@dsyer the docs mention that to publish custom events on the bus you can extend RemoteApplicationEvent and also need to add @JsonTypeNameon your custom class. Project I'm working on had redis binder (which I assume just used Java serialization) and all was good. Now switched to Kafka binder and getting BusJacksonMessageConverter : Could not resolve type id 'xxx' into a subtype of .... I have a tree of classes with the top level extending RemoteApplicationEvent. I tried adding @JsonTypeName to all classes but no dice.

Looking at spring-cloud/spring-cloud-bus@5a14eda, I don't see where @JsonTypeName would be scanned/picked up? Looks like it's only considering classes in the DEFAULT_PACKAGE (see here)

Probably missing something though.

Dave Syer
@dsyer
Apr 22 2016 14:38
The DEFAULT_PACKAGE thing is just so you don't need @JsonTypeName in that package
There are some tests that assert JSON serialization/deserialization for a custom event in a different package
So I guess you have a screwed up Jackson object mapper or something
There was a bug in Stream RC2 to do with Jackson
Maybe try a snapshot?
How did you define the "xxx"?
Donovan Muller
@donovanmuller
Apr 22 2016 19:31
Hmm, I assume the test you're referring to is SubtypeModuleTests
However, in the test the subtype is registered on the ObjectMapper and if I do this with my classes in a similar test it works.
Dave Syer
@dsyer
Apr 22 2016 19:32
I see. Can you open a new issue please?
Donovan Muller
@donovanmuller
Apr 22 2016 19:34
What I don't get is how any other subtype is registered? BusJacksonAutoConfiguration#findSubTypes seems to be where it would be done but... setPackagesToScan only takes the DEFAULT_PACKAGE into account.
Debugging through this block and only classes in org.springframework.cloud.bus.event are scanned
There doesn't seem a way to get a reference to the ObjectMapper to register my own subtypes and wouldn't be able to extend BusJacksonMessageConverter as it as default access.
So a bit lost as to how I can register my own subtypes...
Donovan Muller
@donovanmuller
Apr 22 2016 21:11
:point_up: April 22, 2016 9:32 PM Created: spring-cloud/spring-cloud-bus#33