Coder Social home page Coder Social logo

isabella232 / rabbitmq-jms-client-spring-boot-trader-demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vmware-archive/rabbitmq-jms-client-spring-boot-trader-demo

0.0 0.0 0.0 106 KB

Spring Trader demo app built with RabbitMQ JMS client and Spring Boot

License: Other

Java 56.82% Groovy 43.18%

rabbitmq-jms-client-spring-boot-trader-demo's Introduction

RabbitMQ JMS Client Demo on Spring Boot

This sample application demonstrates the Rabbit JMS connector by producing and consuming stock quotes.

Prerequisites

To use it, you need to have RabbitMQ installed and running with the JMS topic exchange plugin.

Assuming RabbitMQ is running in a local terminal:

$ rabbitmq-server

              RabbitMQ *.*.*. Copyright (C) 2007-2016 Pivotal Software, Inc.
  ##  ##      Licensed under the MPL.  See https://www.rabbitmq.com/
  ##  ##
  ##########  Logs: /usr/local/var/log/rabbitmq/[email protected]
  ######  ##        /usr/local/var/log/rabbitmq/[email protected]
  ##########
              Starting broker... completed with 6 plugins.

…you are now ready to proceed!

Getting started… fast!

One of the fastest ways to get this demo going is using Spring Boot's CLI.

With Spring Boot CLI in PATH, run both parts of the demo with

spring run consumer.groovy producer.groovy

It might take a minute or two to download some dependencies if this is the first time you've used Spring Boot. But after that, you should see something like this:


  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.3.5.RELEASE)

2016-05-31 13:41:53.831  INFO 58645 --- [       runner-0] o.s.boot.SpringApplication               : Starting application on localhost with PID 58645 (/Users/antares/.m2/repository/org/springframework/boot/spring-boot/1.3.5.RELEASE/spring-boot-1.3.5.RELEASE.jar started by antares in /Users/antares/Development/RabbitMQ/jms_boot_demo.git)
2016-05-31 13:41:53.834  INFO 58645 --- [       runner-0] o.s.boot.SpringApplication               : No active profile set, falling back to default profiles: default
2016-05-31 13:41:53.888  INFO 58645 --- [       runner-0] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@5bff0172: startup date [Tue May 31 13:41:53 MSK 2016]; root of context hierarchy
2016-05-31 13:41:54.624  INFO 58645 --- [       runner-0] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'connectionFactory' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=stockConsumer; factoryMethodName=connectionFactory; initMethodName=null; destroyMethodName=(inferred); defined in com.rabbitmq.jms.sample.StockConsumer] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=stockQuoter; factoryMethodName=connectionFactory; initMethodName=null; destroyMethodName=(inferred); defined in com.rabbitmq.jms.sample.StockQuoter]
2016-05-31 13:41:55.027  INFO 58645 --- [       runner-0] com.rabbitmq.jms.sample.StockConsumer    : connectionFactory => RMQConnectionFactory{user='guest', password=xxxxxxxx, host='localhost', port=5672, virtualHost='/', queueBrowserReadMax=0}
2016-05-31 13:41:55.222  INFO 58645 --- [       runner-0] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2016-05-31 13:41:55.230  INFO 58645 --- [       runner-0] o.s.c.support.DefaultLifecycleProcessor  : Starting beans in phase 2147483647
2016-05-31 13:41:55.326  INFO 58645 --- [       runner-0] o.s.boot.SpringApplication               : Started application in 1.768 seconds (JVM running for 4.115)
2016-05-31 13:41:55.389  INFO 58645 --- [pool-3-thread-1] com.rabbitmq.jms.sample.StockQuoter      : Quote...GD is now 94.55
2016-05-31 13:41:55.445  INFO 58645 --- [  jmsListener-1] com.rabbitmq.jms.sample.Receiver         : Received tip Quote...GD is now 94.55
2016-05-31 13:42:00.326  INFO 58645 --- [pool-3-thread-1] com.rabbitmq.jms.sample.StockQuoter      : Quote...BRK.B is now 112.45
2016-05-31 13:42:00.419  INFO 58645 --- [  jmsListener-1] com.rabbitmq.jms.sample.Receiver         : Received tip Quote...BRK.B is now 112.45
2016-05-31 13:42:05.325  INFO 58645 --- [pool-3-thread-1] com.rabbitmq.jms.sample.StockQuoter      : Quote...AAPL is now 455.07
2016-05-31 13:42:05.391  INFO 58645 --- [  jmsListener-1] com.rabbitmq.jms.sample.Receiver         : Received tip Quote...AAPL is now 455.07
2016-05-31 13:42:10.325  INFO 58645 --- [pool-3-thread-1] com.rabbitmq.jms.sample.StockQuoter      : Quote...GD is now 100.22
2016-05-31 13:42:10.361  INFO 58645 --- [  jmsListener-1] com.rabbitmq.jms.sample.Receiver         : Received tip Quote...GD is now 100.22

Building a JAR

To produce a releasable JAR file run

mvn clean package

This creates a JAR file that can be run from the command line:

java -jar target/rabbit-jms-boot-demo-1.0.0-SNAPSHOT.jar

License and Copyright

(c) Pivotal Software, Inc., 2007-2016.

This package, the RabbitMQ JMS client demo on Spring Boot, is double-licensed under the Apache License version 2 ("ASL") and the Mozilla Public License 1.1 ("MPL").

See LICENSE.

rabbitmq-jms-client-spring-boot-trader-demo's People

Contributors

acogoluegnes avatar gregturn avatar michaelklishin avatar spring-operator avatar

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.