mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Polish SampleAmqpSimpleApplication
This commit is contained in:
parent
eeb1e1fc35
commit
f85a7258a6
@ -16,7 +16,8 @@
|
|||||||
|
|
||||||
package smoketest.amqp;
|
package smoketest.amqp;
|
||||||
|
|
||||||
import java.util.Date;
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import org.springframework.amqp.core.Queue;
|
import org.springframework.amqp.core.Queue;
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||||
@ -31,6 +32,8 @@ import org.springframework.messaging.handler.annotation.Payload;
|
|||||||
@RabbitListener(queues = "foo")
|
@RabbitListener(queues = "foo")
|
||||||
public class SampleAmqpSimpleApplication {
|
public class SampleAmqpSimpleApplication {
|
||||||
|
|
||||||
|
private static final Log logger = LogFactory.getLog(SampleAmqpSimpleApplication.class);
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public Sender mySender() {
|
public Sender mySender() {
|
||||||
return new Sender();
|
return new Sender();
|
||||||
@ -43,7 +46,7 @@ public class SampleAmqpSimpleApplication {
|
|||||||
|
|
||||||
@RabbitHandler
|
@RabbitHandler
|
||||||
public void process(@Payload String foo) {
|
public void process(@Payload String foo) {
|
||||||
System.out.println(new Date() + ": " + foo);
|
logger.info(foo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
Loading…
Reference in New Issue
Block a user