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

22nd
Feb 2016
Diyoda Sajjana
@dioode
Feb 22 2016 05:14
Hi Guys, I am trying to use the spring-cloud-stream samples in my application with rabbit-mq, But I get an exception as below
org.springframework.context.ApplicationContextException: Failed to start bean 'outputBindingLifecycle'; nested exception is java.lang.IllegalStateException: Cannot perform binding, no proper implementation found
Any idea on this issue?
Marius Bogoevici
@mbogoevici
Feb 22 2016 05:25
Which sample in particular
There’s no binder implementation pulled in by the sample, but that could be due some misconfiguration.
Diyoda Sajjana
@dioode
Feb 22 2016 05:26
This sample
This message was deleted
Marius Bogoevici
@mbogoevici
Feb 22 2016 05:27
we’ve moved some things around. If you still run into issues, then feel free to file a github issue.
That example in particular uses a direct connection between the source and a sink, so the binder isn’t relevant
(I just tried the ‘double’ example in that repo locally and it seems to work)
Diyoda Sajjana
@dioode
Feb 22 2016 05:32
OK, I think I am using the same samples.
I am using rabbit
this is the stack trace,
Marius Bogoevici
@mbogoevici
Feb 22 2016 05:41
github doesn’t seem to connect properly just now, and it’s fairly late, but I can take a look in the morning
the original link you posted is an older version though, I’d suggest you try mine
if still having issues, please file a bug in github. thanks!
Diyoda Sajjana
@dioode
Feb 22 2016 05:42
Yeah sure, Thanks. Will go through that and see if I missed anything
(y)
Marius Bogoevici
@mbogoevici
Feb 22 2016 05:43
sure, thanks for getting back to us
Marius Bogoevici
@mbogoevici
Feb 22 2016 06:14
@dioode Looks like somehow an older version of spring-rabbit is on the classpath
Make sure that you include 1.5.3.RELEASE - Spring Cloud Stream 1.0.0.M4 pulls it, but something else might override it
Diyoda Sajjana
@dioode
Feb 22 2016 06:17
@mbogoevici I will see the dependencies and fix it and see. Thanks!!
Marius Bogoevici
@mbogoevici
Feb 22 2016 06:17
No problem - it is in fact spring-amqp, but those two go toghether ...
Diyoda Sajjana
@dioode
Feb 22 2016 06:27
That works. I have been using an older spring boot version. That solved the issue thanks!!
Marius Bogoevici
@mbogoevici
Feb 22 2016 06:29
no problem, glad that it worked
Fabian Wallwitz
@cforce
Feb 22 2016 07:29
@spencergibb tx spencer.. using application.properties...sound what i hoped.. but i couldn't find documentation or examples on this .. especially that it works together with @FeignClient this way.. can you point out the doc for this .. i think it would also help to describe or link that in Feign guide
Fabian Wallwitz
@cforce
Feb 22 2016 08:04
what value does the "HystrixCommandKey" and/or group has by default on FeigClient.. how can o modify them?
e.g. for property "hystrix.command.HystrixCommandKey.fallback.isolation.semaphore.maxConcurrentRequests"
Fabian Wallwitz
@cforce
Feb 22 2016 08:11
if i only have an interface annotated with @FeignClient and a method myRestMethod() that represents my RequestMapping.. what is the the "HystrixCommandKey" then by default? Does the @HystrixCommand anotation works on the @FeignClient rest method also, even if its only declarative and interface inheritance? ..
Dave Syer
@dsyer
Feb 22 2016 09:26
Support for Hystrix in Feign is not part of Spring Cloud
There is a gitter room for Feign though (https://gitter.im/Netflix/feign) and some of the same people are in both communities
I believe the command group and key are the url and method name respectively
I don't know if @HystrixCommand works on a generated proxy (like a @FeignClient). Did you try it?
(that one is a Spring Cloud question)
Fabian Wallwitz
@cforce
Feb 22 2016 13:00
some body has an idea why i could get such error message? "No fallback instance of type class Fallback found for feign client dummyservice"
@FeignClient(name="dummyservice", fallback=Fallback.class )
public interface ServiceClient extends IService {}
public class Fallback implements ServiceClient {@Override public byte[] receive(byte[] msg) { return msg;}}
does fallback class must be a Bean?
Dave Syer
@dsyer
Feb 22 2016 13:01
Yes
Fabian Wallwitz
@cforce
Feb 22 2016 13:02
ow .. i think the documentation example misses that
@Component shall be enough?
Dave Syer
@dsyer
Feb 22 2016 13:04
That's a bean. So yes.
Fabian Wallwitz
@cforce
Feb 22 2016 13:06
the documentation shows a case where the fallback class is static class in the same file.. the it works without Bean i assume..
Dave Syer
@dsyer
Feb 22 2016 14:08
It will in some circumstances
I would always be explicit if I were you
We can change the docs.
PR welcome.
Guillaume Larose
@theonlyguills
Feb 22 2016 16:02
Hi! The autoconfig for sleuth (precisely the TraceWebClientAutoConfiguration) insists on having a RestTemplate autowired into it. When using OAuth2 there are more than 1 resttemplates created in the context and that fails on boot. Any tips / workarounds on that for now?
Dave Syer
@dsyer
Feb 22 2016 16:03
Can you create a simple sample?
Marcin Grzejszczak
@marcingrzejszczak
Feb 22 2016 16:03
and which version of sleuth are you using?
Dave Syer
@dsyer
Feb 22 2016 16:04
I think it's the AsyncRestTemplate @Bean that needs to be autowired?
Marcin Grzejszczak
@marcingrzejszczak
Feb 22 2016 16:04
but AsyncRestTemplate is ConditionalOnMissingBean
Dave Syer
@dsyer
Feb 22 2016 16:04
So you can switch that off by providing your own instance as a workaround.
Marcin Grzejszczak
@marcingrzejszczak
Feb 22 2016 16:04
yup
Guillaume Larose
@theonlyguills
Feb 22 2016 16:04
OK. cause yeah, the async wants a RestTemplate as a parameter, but when using OAuth it finds 2 (the userInfoRestTemplate and the loadBalancedOAuth2RestTemplate)
I can override that bean for now
public AsyncRestTemplate asyncRestTemplate(SpanAccessor spanAccessor, AsyncClientHttpRequestFactory asyncClientHttpRequestFactory, RestTemplate restTemplate) {
to put context
Dave Syer
@dsyer
Feb 22 2016 16:07
Why do we create a @Beanof type AsyncRestTemplate?
Is it just a convenience for users?
Guillaume Larose
@theonlyguills
Feb 22 2016 16:08
im guessing to async post to zipkin? I don't know, I haven't looked into it more. I only want the rabbit functionality
Dave Syer
@dsyer
Feb 22 2016 16:08
There is no zipkin in sleuth core
So it's definitely not that
Marcin Grzejszczak
@marcingrzejszczak
Feb 22 2016 16:10
yes - it's a convienience
cause we're wrapping the AsyncClientHttpRequestFactory with TraceAsyncClientHttpRequestFactoryWrapper
Guillaume Larose
@theonlyguills
Feb 22 2016 16:11
it's rather inconvenient in this case ^^
Dave Syer
@dsyer
Feb 22 2016 16:11
Yeah. And it's not like every sleuth app will need it.
Marcin Grzejszczak
@marcingrzejszczak
Feb 22 2016 16:12
hmm we could instead of passing RestTemplate via a method argument we can pass the restTemplate() bean method
Dave Syer
@dsyer
Feb 22 2016 16:12
Not a good idea generally
since that method is @ConditionalOnBean
Marcin Grzejszczak
@marcingrzejszczak
Feb 22 2016 16:12
yeah you're right
we could extract this async thing into a separate configuration and someone can just disable it via a property
Dave Syer
@dsyer
Feb 22 2016 16:13
I think that's a good idea
We can't do much better, given we need to wrap the client factory.
Marcin Grzejszczak
@marcingrzejszczak
Feb 22 2016 16:14
yup
I'll move it aside
Dave Syer
@dsyer
Feb 22 2016 16:14
I notice that we have to wrap the factory and the executor inside the factory
Seems a bit ugly
It would be neater if we only had to wrap one of them
then we could ask a user to create that for us, and only create the AsyncRestTemplate if that thing existed
Guillaume Larose
@theonlyguills
Feb 22 2016 16:17
Sorry for the can of worms! Thanks for the help though.
Marcin Grzejszczak
@marcingrzejszczak
Feb 22 2016 16:18
@dsyer you're right - we could return a wrapped AsyncListenableTaskExecutor with TraceAsyncClientHttpRequestFactoryWrapper
@theonlyguills - hey, feedback is what is crucial for us to make good libs
Marcin Grzejszczak
@marcingrzejszczak
Feb 22 2016 16:26

then we could ask a user to create that for us, and only create the AsyncRestTemplate if that thing existed

actually we acn create an AsyncRestTemplate without RestTemplate

I'll do some tweaking and the issue will be gone :)
Dave Syer
@dsyer
Feb 22 2016 16:26
There is still the question of whether we should create one
if the user hasn't signalled in some way that he needs it
I think injecting a RestTemplate might be a reasonable idea. What does it get used for?
Probably if it was @LoadBalanced that would be some benefit for the user?
Marcin Grzejszczak
@marcingrzejszczak
Feb 22 2016 16:29
But there is no @LoadBalanced AsyncRestTemplate yet
and I've passing the @LoadBalanced RestTemplate to an Async one and it worked fine
Dave Syer
@dsyer
Feb 22 2016 16:30
That's what I meant, I think.
Marcin Grzejszczak
@marcingrzejszczak
Feb 22 2016 16:30
the thing is that if someone wants to use such a rest template then he should set it himself
but he has to use our wrapped AsyncClientHttpRequestFactory
Dave Syer
@dsyer
Feb 22 2016 16:30
Yeah
So maybe what we need is just a BeanPostProcessor that wraps a AsyncClientHttpRequestFactory into a tracing one?
and leave the rest up to the user
Marcin Grzejszczak
@marcingrzejszczak
Feb 22 2016 16:32
@Bean
    @ConditionalOnMissingBean
    public AsyncClientHttpRequestFactory asyncClientHttpRequestFactory(SpanAccessor spanAccessor, Tracer tracer) {
        SimpleClientHttpRequestFactory simpleClientHttpRequestFactory = new SimpleClientHttpRequestFactory();
        simpleClientHttpRequestFactory.setTaskExecutor(asyncListenableTaskExecutor(tracer));
        return new TraceAsyncClientHttpRequestFactoryWrapper(spanAccessor, simpleClientHttpRequestFactory);
    }

    private AsyncListenableTaskExecutor asyncListenableTaskExecutor(Tracer tracer) {
        ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
        threadPoolTaskScheduler.initialize();
        return new TraceAsyncListenableTaskExecutor(threadPoolTaskScheduler, tracer);
    }
we're doing 2 things: wrapping ThreadPoolTaskScheduler and the AsyncClientHttpRequestFactory
and the first one can't be a bean cause we will have two (one is in websockets)
Dave Syer
@dsyer
Feb 22 2016 16:36
A TaskExecutor as a bean is probably dangerous
Marcin Grzejszczak
@marcingrzejszczak
Feb 22 2016 16:43
I mean we can provide the classes without creating beans
and create documentation of how to work with all of that
Dave Syer
@dsyer
Feb 22 2016 16:44
I'm conflicted.
Marcin Grzejszczak
@marcingrzejszczak
Feb 22 2016 16:44
but I think that in majority of cases (maybe I'm wrong) it's better to have some defaults
and disable them on a switch
Marcin Grzejszczak
@marcingrzejszczak
Feb 22 2016 17:35
@theonlyguills with the latest snapshots you shouldn't have that problem anymore
it's being built
Guillaume Larose
@theonlyguills
Feb 22 2016 18:51
Awesome!