SpringCloudDemo | SpringCloud相关demo实例
kandi X-RAY | SpringCloudDemo Summary
kandi X-RAY | SpringCloudDemo Summary
SpringCloud相关demo实例
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Run the sample client .
- Gets a user
- Gets user infostr .
- Print info .
- The rest template .
- Get a fallback message .
- Executes the command .
- Sets the name .
- Set the sex .
SpringCloudDemo Key Features
SpringCloudDemo Examples and Code Snippets
Community Discussions
Trending Discussions on SpringCloudDemo
QUESTION
I have two applications that are throwing messages at each other using Spring Cloud stream and rabbitmq binder. I am unable to subscribe to the global or dedicated error channel. I am sure I am missing one of the annotation prayers to one of the Spring framework gods.
I have tried to simplify the code to the following. (Code is also available on https://github.com/achintmehta/springclouddemo)
In the following code, I am trying to send a message to INPUT channel and returning a message on OUTPUT channel. The stream listener for INPUT channel throws an exception and I see logHandler printing the exception but none of my registered endpoints for errors get called.
...ANSWER
Answered 2019-Apr-03 at 06:39There are few things that are wrong with your application
Why are you injecting Processor in your application? I mean the whole purpose for it is to signal to the framework to create necessary bindings to bridge/map local channels with remote destinations (Kafka, Rabbit etc). This means that when you send message to the
input
channel directly you are completely bypassing spring-cloud-stream framework and all its features including error handling, message conversion, retries etc. Basically at that point you are simply NOT using spring-cloud-stream. When you throw an exception the exception is propagated back to the original caller. In the case of spring-cloud-stream the original caller is message listening container which catches exception, does retries and then goes through error handling routine including sending to error channel(s). In your case the original caller is you viasource.input().send(...)
, not the framework.The signature here is wrong:
@ServiceActivator(inputChannel="errorChannel") public ErrorMessage onError(ErrorMessage message)
. By returning anything other thanvoid
what are your expectations? Where would the ErrorMessage go?
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install SpringCloudDemo
You can use SpringCloudDemo like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the SpringCloudDemo component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page