FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
rabbitmq-tutorials/java/EmitLog.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
/
EmitLog.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
26 lines (19 loc) · 900 Bytes
Breadcrumbs
rabbitmq-tutorials
/
java
/
EmitLog.java
Copy path
File metadata and controls
26 lines (19 loc) · 900 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
24
25
import
com
.
rabbitmq
.
client
.
BuiltinExchangeType
;
import
com
.
rabbitmq
.
client
.
Channel
;
import
com
.
rabbitmq
.
client
.
Connection
;
import
com
.
rabbitmq
.
client
.
ConnectionFactory
;
public
class
EmitLog
{
private
static
final
String
EXCHANGE_NAME
=
"logs"
;
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
.
exchangeDeclare
(
EXCHANGE_NAME
,
BuiltinExchangeType
.
FANOUT
);
String
message
=
argv
.
length
<
1
?
"info: Hello World!"
:
String
.
join
(
" "
,
argv
);
channel
.
basicPublish
(
EXCHANGE_NAME
,
""
,
null
,
message
.
getBytes
(
"UTF-8"
));
System
.
out
.
println
(
" [x] Sent '"
+
message
+
"'"
);
}
}
}
Back
|
FazBrowse Home
|
New Git URL