GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — rabbitmq-tutorials/java at master · flbing/rabbitmq-tutorials

Expand file tree

/

java

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

java

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
.idea
.idea
 
 
EmitLog.java
EmitLog.java
 
 
EmitLogDirect.java
EmitLogDirect.java
 
 
EmitLogHeader.java
EmitLogHeader.java
 
 
EmitLogTopic.java
EmitLogTopic.java
 
 
NewTask.java
NewTask.java
 
 
README.md
README.md
 
 
RPCClient.java
RPCClient.java
 
 
RPCServer.java
RPCServer.java
 
 
ReceiveLogHeader.java
ReceiveLogHeader.java
 
 
ReceiveLogs.java
ReceiveLogs.java
 
 
ReceiveLogsDirect.java
ReceiveLogsDirect.java
 
 
ReceiveLogsTopic.java
ReceiveLogsTopic.java
 
 
Recv.java
Recv.java
 
 
Send.java
Send.java
 
 
Worker.java
Worker.java
 
 
recompile.sh
recompile.sh
 
 

README.md

Outline

Java code for RabbitMQ tutorials

Here you can find the Java code examples from RabbitMQ tutorials.

To successfully use the examples you will need a running RabbitMQ server.

Requirements

You'll need to download the following JAR files from Maven Central:

  • RabbitMQ Java Client
  • SLF4J API
  • SLF4J Simple

Copy those files in your working directory, along the tutorials Java files.

To compile you only need the Rabbitmq Java Client jar on the classpath.

To run them you'll need all the dependencies, see examples below.

Note: If you're on Windows, use a semicolon instead of a colon to separate items in the classpath.

You can set an environment variable for the jar files on the classpath e.g.

 $ export CP=.:amqp-client-4.0.2.jar:slf4j-api-1.7.21.jar:slf4j-simple-1.7.22.jar
 $ java -cp $CP Send

or on Windows:

 > set CP=.;amqp-client-4.0.2.jar;slf4j-api-1.7.21.jar;slf4j-simple-1.7.22.jar
 > java -cp %CP% Send

Code

Tutorial one: "Hello World!":

$ javac -cp amqp-client-4.0.2.jar Send.java Recv.java

$ java -cp .:amqp-client-4.0.2.jar:slf4j-api-1.7.21.jar:slf4j-simple-1.7.22.jar Send
$ java -cp .:amqp-client-4.0.2.jar:slf4j-api-1.7.21.jar:slf4j-simple-1.7.22.jar Recv

Tutorial two: Work Queues:

$ javac -cp amqp-client-4.0.2.jar NewTask.java Worker.java

$ java -cp $CP NewTask
$ java -cp $CP Worker

Tutorial three: Publish/Subscribe

$ javac -cp amqp-client-4.0.2.jar EmitLog.java ReceiveLogs.java

$ java -cp $CP ReceiveLogs
$ java -cp $CP EmitLog
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.