FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
rabbitmq-tutorials/java/Send.java at main · rabbitmq/rabbitmq-tutorials · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
rabbitmq
/
rabbitmq-tutorials
Public
Notifications
You must be signed in to change notification settings
Fork
3.5k
Star
6.9k
Code
Issues
3
Pull requests
1
Discussions
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
rabbitmq-tutorials
/
java
/
Send.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
23 lines (19 loc) · 871 Bytes
Breadcrumbs
rabbitmq-tutorials
/
java
/
Send.java
Copy path
File metadata and controls
23 lines (19 loc) · 871 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import
com
.
rabbitmq
.
client
.
Channel
;
import
com
.
rabbitmq
.
client
.
Connection
;
import
com
.
rabbitmq
.
client
.
ConnectionFactory
;
import
java
.
nio
.
charset
.
StandardCharsets
;
import
java
.
util
.
Map
;
public
class
Send
{
private
final
static
String
QUEUE_NAME
=
"hello"
;
public
static
void
main
(
String
[]
argv
)
throws
Exception
{
ConnectionFactory
factory
=
new
ConnectionFactory
();
factory
.
setHost
(
"localhost"
);
try
(
Connection
connection
=
factory
.
newConnection
();
Channel
channel
=
connection
.
createChannel
()) {
channel
.
queueDeclare
(
QUEUE_NAME
,
true
,
false
,
false
,
Map
.
of
(
"x-queue-type"
,
"quorum"
));
String
message
=
"Hello World!"
;
channel
.
basicPublish
(
""
,
QUEUE_NAME
,
null
,
message
.
getBytes
(
StandardCharsets
.
UTF_8
));
System
.
out
.
println
(
" [x] Sent '"
+
message
+
"'"
);
}
}
}
Back
|
FazBrowse Home
|
New Git URL