Git Product home page Git Product logo

spring-amqp-samples's Introduction

This project hosts some samples that complement Spring AMQP, showing you how to get started with Spring and AMQP.

Build Instructions

Install the RabbitMQ broker first (version 2.3.1 or better). Then clone from GIT and then use Maven (2.1.*):

$ git clone ...
$ mvn install

SpringSource ToolSuite users (or Eclipse users with the latest m2eclipse plugin) can import the projects as existing Maven projects.

The basic HelloWorld sample has two versions (with synchronous and asynchronous consumers). Both have two Java classes called Producer and Consumer with main methods to launch. Run the producer first and ensure that the broker is already running.

The Stocks sample has a UI that can be launched as a Java main, and a daemon server process with the same properties. You can run them from an IDE easily. Run the Server and then the Client and you should see a swing client pop up and stock tickers appearing. To run from the command line you can use the Maven exec plugin:

$ mvn exec:java -Dexec.classpathScope=test -Dexec.mainClass=org.springframework.amqp.rabbit.stocks.Server &
$ mvn exec:java -Dexec.classpathScope=test -Dexec.mainClass=org.springframework.amqp.rabbit.stocks.Client

In the example above we backgrounded the server process, or you could run it in a different window to make things clearer in the console logs.

Web UI

The Stocks sample is also a web application. You should be able to run it in your IDE, e.g. if you imported the project into STS (or Eclipse with Maven support) you can drag it onto a server, or use Run As...->On Server. From the command line you can use

$ mvn jetty:run

The web UI is designed like the swing client - it has a ticker table that updates every second (if there is any new data), and an order entry form. The QuoteController manages the interaction between the browser and the application and between the application and the AMQP broker.

RabbitMQ Tutorials

Spring Boot versions of the 6 standard RabbitMQ tutorials are provided in rabbitmq-tutorials.

Spring Boot Applications

Several Spring Boot applications are also provided, with names spring-rabbit-.... Explore their individual READMEs for more information.

Contributing to Spring AMQP Samples

Here are some ways for you to get involved in the community:

  • Get involved with the Spring community on the Spring Community Forums. Please help out on the forum by responding to questions and joining the debate.
  • Create JIRA tickets for bugs and new features and comment and vote on the ones that you are interested in.
  • Github is for social coding: if you want to write code, we encourage contributions through pull requests from forks of this repository. If you want to contribute code this way, please reference a JIRA ticket as well covering the specific issue you are addressing.
  • Watch for upcoming articles on Spring by subscribing to springframework.org

Refer to the spring-amqp Contributor's Guidelines for complete information about the necessary steps.

Code Conventions and Housekeeping

None of these is essential for a pull request, but they will all help. They can also be added after the original pull request but before a merge.

  • Use the Spring Framework code format conventions (import eclipse-code-formatter.xml from the root of the project if you are using Eclipse).
  • Make sure all new .java files to have a simple Javadoc class comment with at least an @author tag identifying you, and preferably at least a paragraph on what the class is for.
  • Add the ASF license header comment to all new .java files (copy from existing files in the project)
  • Add yourself as an @author to the .java files that you modify substantially (more than cosmetic changes).
  • Add some Javadocs and, if you change the namespace, some XSD doc elements (Spring AMQP is not stellar in this area yet, but it will have to come up to scratch one day, so you will be helping a lot).
  • A few unit tests would help a lot as well - someone has to do it.
  • If no-one else is using your branch, please rebase it against the current master (or other target branch in the main project).

spring-amqp-samples's People

Contributors

aaguilera avatar artembilan avatar cbeams avatar dependabot[bot] avatar dsyer avatar ealden avatar garyrussell avatar giuliopulina avatar markfisher avatar sdeeg-pivotal avatar spring-operator avatar ssabat avatar volkerk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spring-amqp-samples's Issues

Sample log4j2 doesn't work with spring-boot >=2.0.0.RELEASE

Reproduce steps:

  1. Start latest windows RabbitMQ on localhost:5672

  2. checkout master branch from this project spring-amqp-samples

  3. Go to module log4j2. You can see the spring-boot version should be 2.2.2.RELEASE in log4j2/pom.xml

  4. Run module log4j2. get error log from stdout

main ERROR Appenders contains an invalid element or attribute "RabbitMQ"
main ERROR Unable to locate appender "rabbitmq" for logger config "org.springframework.amqp.samples.log4j2"

  1. Delete exchange log4j2Sample from RabbitMQ management UI, because default value of durable in annotation org.springframework.amqp.rabbit.annotation.Exchange are different between different spring-rabbit version.

  2. Change spring-boot-starter-parent version in log4j2/pom.xml to 1.5.x.RELEASE (I tested 1.5.3, 1.5.10, 1.5.22), run module log4j2, sample works and you can see log

Log via AmqpAppender: Sun Jan 26 11:08:21 CST 2020
Logs over Log4J AmqpAppender: Log via AmqpAppender: Sun Jan 26 11:08:21 CST 2020

  1. Delete exchange log4j2Sample from RabbitMQ management UI, because default value of durable in annotation org.springframework.amqp.rabbit.annotation.Exchange are different between different spring-rabbit version.

  2. Change spring-boot-starter-parent version in log4j2/pom.xml to 2.0.0.RELEASE, run module log4j2, get error log

2020-01-26 11:10:31,034 main ERROR Unable to invoke factory method in class org.springframework.amqp.rabbit.log4j2.AmqpAppender for element RabbitMQ: java.lang.ExceptionInInitializerError java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:136)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:958)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:898)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:890)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:513)
at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:237)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:249)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:617)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:634)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:229)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:153)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
at org.apache.commons.logging.LogFactory$Log4jLog.(LogFactory.java:199)
at org.apache.commons.logging.LogFactory$Log4jDelegate.createLog(LogFactory.java:166)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:109)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:99)
at org.springframework.amqp.samples.log4j2.SpringBootAmqpAppenderApplication.(SpringBootAmqpAppenderApplication.java:43)
Caused by: java.lang.ExceptionInInitializerError
at org.springframework.expression.spel.SpelParserConfiguration.(SpelParserConfiguration.java:36)
at org.springframework.expression.spel.standard.SpelExpressionParser.(SpelExpressionParser.java:42)
at org.springframework.amqp.rabbit.core.RabbitTemplate.(RabbitTemplate.java:156)
at org.springframework.amqp.rabbit.log4j2.AmqpAppender.(AmqpAppender.java:120)
at org.springframework.amqp.rabbit.log4j2.AmqpAppender.createAppender(AmqpAppender.java:229)
... 23 more
Caused by: java.lang.NullPointerException
at org.apache.commons.logging.LogFactory$Log4jLog.(LogFactory.java:204)
at org.apache.commons.logging.LogFactory$Log4jDelegate.createLog(LogFactory.java:166)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:109)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:99)
at org.springframework.core.SpringProperties.(SpringProperties.java:53)
... 28 more
2020-01-26 11:10:31,038 main ERROR Null object returned for RabbitMQ in Appenders.
2020-01-26 11:10:31,043 main ERROR Unable to locate appender "rabbitmq" for logger config "org.springframework.amqp.samples.log4j2"
Exception in thread "main" java.lang.NoSuchMethodError: org.springframework.boot.SpringApplication.run(Ljava/lang/Object;[Ljava/lang/String;)Lorg/springframework/context/ConfigurableApplicationContext;
at org.springframework.amqp.samples.log4j2.SpringBootAmqpAppenderApplication.main(SpringBootAmqpAppenderApplication.java:46)
Process finished with exit code 1

Cannot build the project due to missing artefacts in maven central repository

Hello!
I've downloaded the project and tried to build. Unfortunately I could not succeeded due to:
project spring-rabbit-stocks: Could not resolve dependencies for project org.springframework.samples.spring:spring-rabbit-stocks:war:1.0.0.BUILD-SNAPSHOT: The following artifacts could not be resolved: org.springframework.amqp:spring-amqp:jar:1.3.0.RC1, org.springframework.amqp:spring-rabbit:jar:1.3.0.RC1: Failure to find org.springframework.amqp:spring-amqp:jar:1.3.0.RC1 in http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced

Can you please write what maven repository we should use?
Thanks.

How to configure Global Error Handler @RabbitListener annotation's errorHandler attribute

Hi, I looked at your example of spring-rabbit-global-errorhandler. we already have a custom errorHandler which implements RabbitListenerErrorHandler interface which is configured by @RabbitListener annotation's attribute errorHandler. But this does'nt catch any ​MessageConversionExceptions. I understand that those are caught by ConditionalRejectingErrorHandler. we want to catch those type of problems and write to database. What's the best way to configure errorHandler to achieve this?

Apologies if this is not the right place to ask this question.

Wrong documentation for delayed message

In the chapter of Reference Manual said:

properties.setXDelay(15000);

when this method doesn't exists.

The correct method is (setDelay):

/**
* Set the x-delay header.
* @param delay the delay.
* @SInCE 1.6
*/
public void setDelay(Integer delay) {
if (delay == null || delay < 0) {
this.headers.remove(X_DELAY);
}
else {
this.headers.put(X_DELAY, delay);
}
}

how to find params with amp

for example, you use
spring.rabbitmq.publisher-confirms: true
spring.rabbitmq.publisher-returns: true
spring.rabbitmq.template.mandatory: true
and there are alsl
spring.rabbitmq.username...password
is there a document reference to all spring.rabbitmq.* ?

spring-rabbit-stocks webapp does not work

Hi,

I'm trying to use spring-rabbit-stocks web application using mvn jetty:run.
When I try to access the application at http://localhost:8080 I have this message:

Error 404 - Not Found. No context on this server matched or handled this request. Contexts known to this server are: /spring-rabbit-stocks ---> org.mortbay.jetty.plugin.Jetty6PluginWebAppContext@9d200de{/spring-rabbit-stocks,C:\projects\spring-amqp-samples\stocks\src\main\webapp}

Trying with http://localhost:8080/spring-rabbit-stocks/ gives this error message:

HTTP ERROR 500 Problem accessing /spring-rabbit-stocks/. Reason: javax.servlet.http.HttpServletResponse.getStatus()I Caused by: java.lang.NoSuchMethodError: javax.servlet.http.HttpServletResponse.getStatus()I at org.springframework.web.servlet.FrameworkServlet.publishRequestHandledEvent(FrameworkServlet.java:1146) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1023) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)

I'm opening a PR to add support to Servlet 3.1.

Fix for Running Receiver and Sender at the same time on a Single Server

In order to avoid port clashes between sender and receivers in the RabbitMQ tutorials project it would be better to have the receiver start on a different port than the sender.

I fixed this on my copy of the application by doing this.

@Profile("receiver")
  private static class ReceiverConfig {

    @Bean
    public EmbeddedServletContainerCustomizer containerCustomizer() {
      return (container -> {
        container.setPort(8012);
      });
    }

    @Bean
    public Tut5Receiver receiver() {
      return new Tut5Receiver();
    }

Invalid property 'rabbitTemplate' of bean class RabbitMarketDataGateway

Hello I tried running the sample stocks and got the below error:

[ERROR] Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'marketDataGateway' defined in class path resource [server-messaging.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'rabbitTemplate' of bean class [org.springframework.amqp.rabbit.stocks.gateway.RabbitMarketDataGateway]: Bean property 'rabbitTemplate' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?: org.springframework.beans.NotWritablePropertyException: Invalid property 'rabbitTemplate' of bean class [org.springframework.amqp.rabbit.stocks.gateway.RabbitMarketDataGateway]: Bean property 'rabbitTemplate' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? at org.springframework.beans.BeanWrapperImpl.createNotWritablePropertyException (BeanWrapperImpl.java:243)

log4j module have error when run

java.lang.NoSuchMethodError: org.springframework.core.MethodParameter.nestedIfOptional()Lorg/springframework/core/MethodParameter;

maybe spring version too low(4.2.9);
this method is suported by 4.3

build stock has error

Hi!
Thank in advance for any help.
I use apache maven 3.3.3 to build stock.
Here is the errors:
[ERROR] Failed to execute goal on project spring-rabbit-stocks: Could not resolve dependencies for project org.springframework.samples.spring:spring-rabbit-stocks:war:2.1.0.RC1: The following artifacts could not be resolved: org.springframework.amqp:spring-amqp:jar:2.1.0.RC1, org.springframework.amqp:spring-rabbit:jar:2.1.0.RC1: Failure to find org.springframework.amqp:spring-amqp:jar:2.1.0.RC1 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project spring-rabbit-stocks: Could not resolve dependencies for project org.springframework.samples.spring:spring-rabbit-stocks:war:2.1.0.RC1: The following artifacts could not be resolved: org.springframework.amqp:spring-amqp:jar:2.1.0.RC1, org.springframework.amqp:spring-rabbit:jar:2.1.0.RC1: Failure to find org.springframework.amqp:spring-amqp:jar:2.1.0.RC1 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced

hi!help me

D:\spring-github>mvn exec:java -Dexec.classpathScope=test -Dexec.mainClass=org.springframework.amqp.rabbit.stocks.Server &
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Spring AMQP Hello World
[INFO] Spring Rabbit Stocks
[INFO] Spring AMQP log4j
[INFO] Spring AMQP Samples
[WARNING] The POM for com.springsource.bundlor:com.springsource.bundlor.maven:jar:1.0.0.M1B is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for com.springsource.bundlor:com.springsource.bundlor.maven:1.0.0.M1B: Plugin com.springsource.bundlor:com.springsource.bundlor.maven:1.0.0.M1B or
one of its dependencies could not be resolved: Failure to find com.springsource.bundlor:com.springsource.bundlor.maven:jar:1.0.0.M1B in http://nexus.xxx.aaaa:8080/nexus/content/groups/public/
was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Spring AMQP Hello World 1.4.3.RELEASE
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.springsource.bundlor:com.springsource.bundlor.maven:jar:1.0.0.M1B is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for com.springsource.bundlor:com.springsource.bundlor.maven:1.0.0.M1B: Plugin com.springsource.bundlor:com.springsource.bundlor.maven:1.0.0.M1B or
one of its dependencies could not be resolved: Failure to find com.springsource.bundlor:com.springsource.bundlor.maven:jar:1.0.0.M1B in http://nexus.xxx.aaaa:8080/nexus/content/groups/public/
was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced
[INFO]
[INFO] --- exec-maven-plugin:1.3.2:java (default-cli) @ spring-rabbit-helloworld ---
[WARNING] Warning: killAfter is now deprecated. Do you need it ? Please comment on MEXEC-6.
[WARNING]
java.lang.ClassNotFoundException: org.springframework.amqp.rabbit.stocks.Server
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:281)
at java.lang.Thread.run(Thread.java:744)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Spring AMQP Hello World ............................ FAILURE [ 0.665 s]
[INFO] Spring Rabbit Stocks ............................... SKIPPED
[INFO] Spring AMQP log4j .................................. SKIPPED
[INFO] Spring AMQP Samples ................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.322 s
[INFO] Finished at: 2015-03-14T17:56:24+08:00
[INFO] Final Memory: 10M/174M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3.2:java (default-cli) on project spring-rabbit-helloworld: An exception occured while executing the Java class. org.springfr
amework.amqp.rabbit.stocks.Server -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

spring-amqp with mqtt

spring-amqp publish message,mqtt subscribe.
I have successfully implemented publish/subscribe.
for example publish :

CachingConnectionFactory cf = new CachingConnectionFactory();
RabbitAdmin admin = new RabbitAdmin(cf);

MessageProperties props = MessagePropertiesBuilder.newInstance()
                .setContentType(MessageProperties.CONTENT_TYPE_TEXT_PLAIN)
                .build();
Message message = MessageBuilder.withBody("ok!".getBytes("UTF-8"))
                .andProperties(props)
                .build();
RabbitTemplate template = admin.getRabbitTemplate();
template.send("amq.topic", "test.*", message);

What do I need to add code,confirm mqtt successfully received a message?
Besides,listen queue remove/add need code

Exception when I run the example of log4j2 with rabbitmq in docker

Hi, I ran the example of log4j2 it completes well 3 or 4 times the message delivery, but at the fifth attemp a connection exception is appearing. I'm attaching the stacktrace of the exception, why could be happening this one? I'm using docker to deploy my rabbitmq server.

org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused: connect
at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:62) ~[spring-rabbit-1.6.0.RC1.jar:?]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:300) ~[spring-rabbit-1.6.0.RC1.jar:?]
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:547) ~[spring-rabbit-1.6.0.RC1.jar:?]
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$1.createConnection(ConnectionFactoryUtils.java:90) ~[spring-rabbit-1.6.0.RC1.jar:?]
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.java:140) ~[spring-rabbit-1.6.0.RC1.jar:?]
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.java:76) ~[spring-rabbit-1.6.0.RC1.jar:?]
at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1345) ~[spring-rabbit-1.6.0.RC1.jar:?]
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1338) ~[spring-rabbit-1.6.0.RC1.jar:?]
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1314) ~[spring-rabbit-1.6.0.RC1.jar:?]
at org.springframework.amqp.rabbit.core.RabbitAdmin.getQueueProperties(RabbitAdmin.java:335) ~[spring-rabbit-1.6.0.RC1.jar:?]
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.redeclareElementsIfNecessary(SimpleMessageListenerContainer.java:1101) [spring-rabbit-1.6.0.RC1.jar:?]
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$700(SimpleMessageListenerContainer.java:95) [spring-rabbit-1.6.0.RC1.jar:?]
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1277) [spring-rabbit-1.6.0.RC1.jar:?]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111]
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) ~[?:1.8.0_111]
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85) ~[?:1.8.0_111]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[?:1.8.0_111]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[?:1.8.0_111]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[?:1.8.0_111]
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) ~[?:1.8.0_111]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:1.8.0_111]
at java.net.Socket.connect(Socket.java:589) ~[?:1.8.0_111]
at com.rabbitmq.client.impl.FrameHandlerFactory.create(FrameHandlerFactory.java:32) ~[amqp-client-3.6.0.jar:?]
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:676) ~[amqp-client-3.6.0.jar:?]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:287) ~[spring-rabbit-1.6.0.RC1.jar:?]
... 12 more

Thread name information not available in AMQP message?

I was today playing with the AMQPAppender for log4j2, (i.e. org.springframework.amqp.rabbit.log4j2.AmqpAppender) and I was not able to find the way to configure a pattern layout for the output log messages when using log4j2.xml as the way to store the configuration. I do need to include the threadname in the log messages sent to RabbitMQ, so I can track properly each execution path after aggregating the logs. I was looking for examples on this, but I could not find any. Is there a way to apply a layout to the rabbitmq log messages via XML config for log4j2, just as it can be done for a Console appender?

Spring Rabbit Json pom.xml points to non existing repo?

For http://repo.spring.io/repo
i get

{
"errors" : [ {
"status" : 404,
"message" : "Not Found"
} ]
}

see also
<repositories> <repository> <snapshots> <enabled>true</enabled> </snapshots> <id>repository.springframework.maven.all</id> <name>Spring Framework Repository Including Staging</name> <url>http://repo.spring.io/repo</url> </repository> </repositories>

in the pom.xml of spring-rabbit-json

RabbitMQ - Socket Exception

Getting this exception when our code in our endpoints trying to communicate with RMQ . We are using cachingConnectionFactory and TopicExchange.

error=org.springframework.amqp.AmqpIOException: java.net.SocketException: Connection timed out (Write failed) at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:63) at org.springframework.amqp.rabbit.connection.RabbitAccessor.convertRabbitAccessException(RabbitAccessor.java:110) at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:968) at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:945) at org.springframework.amqp.rabbit.core.RabbitTemplate.send(RabbitTemplate.java:470) at org.springframework.amqp.rabbit.core.RabbitTemplate.convertAndSend(RabbitTemplate.java:535) at org.springframework.amqp.rabbit.core.RabbitTemplate.convertAndSend(RabbitTemplate.java:522)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.