File tree Expand file tree Collapse file tree 4 files changed +8
-12
lines changed Expand file tree Collapse file tree 4 files changed +8
-12
lines changed Original file line number Diff line number Diff line change
1
+ import com .rabbitmq .client .BuiltinExchangeType ;
1
2
import com .rabbitmq .client .Channel ;
2
3
import com .rabbitmq .client .Connection ;
3
4
import com .rabbitmq .client .ConnectionFactory ;
@@ -11,7 +12,7 @@ public static void main(String[] argv) throws Exception {
11
12
factory .setHost ("localhost" );
12
13
try (Connection connection = factory .newConnection ();
13
14
Channel channel = connection .createChannel ()) {
14
- channel .exchangeDeclare (EXCHANGE_NAME , "fanout" );
15
+ channel .exchangeDeclare (EXCHANGE_NAME , BuiltinExchangeType . FANOUT );
15
16
16
17
String message = argv .length < 1 ? "info: Hello World!" :
17
18
String .join (" " , argv );
Original file line number Diff line number Diff line change
1
+ import com .rabbitmq .client .BuiltinExchangeType ;
1
2
import com .rabbitmq .client .Channel ;
2
3
import com .rabbitmq .client .Connection ;
3
4
import com .rabbitmq .client .ConnectionFactory ;
@@ -12,7 +13,7 @@ public static void main(String[] argv) throws Exception {
12
13
try (Connection connection = factory .newConnection ();
13
14
Channel channel = connection .createChannel ()) {
14
15
15
- channel .exchangeDeclare (EXCHANGE_NAME , "topic" );
16
+ channel .exchangeDeclare (EXCHANGE_NAME , BuiltinExchangeType . TOPIC );
16
17
17
18
String routingKey = getRouting (argv );
18
19
String message = getMessage (argv );
Original file line number Diff line number Diff line change 1
- import com .rabbitmq .client .Channel ;
2
- import com .rabbitmq .client .Connection ;
3
- import com .rabbitmq .client .ConnectionFactory ;
4
- import com .rabbitmq .client .DeliverCallback ;
1
+ import com .rabbitmq .client .*;
5
2
6
3
public class ReceiveLogs {
7
4
private static final String EXCHANGE_NAME = "logs" ;
@@ -12,7 +9,7 @@ public static void main(String[] argv) throws Exception {
12
9
Connection connection = factory .newConnection ();
13
10
Channel channel = connection .createChannel ();
14
11
15
- channel .exchangeDeclare (EXCHANGE_NAME , "fanout" );
12
+ channel .exchangeDeclare (EXCHANGE_NAME , BuiltinExchangeType . FANOUT );
16
13
String queueName = channel .queueDeclare ().getQueue ();
17
14
channel .queueBind (queueName , EXCHANGE_NAME , "" );
18
15
Original file line number Diff line number Diff line change 1
- import com .rabbitmq .client .Channel ;
2
- import com .rabbitmq .client .Connection ;
3
- import com .rabbitmq .client .ConnectionFactory ;
4
- import com .rabbitmq .client .DeliverCallback ;
1
+ import com .rabbitmq .client .*;
5
2
6
3
public class ReceiveLogsTopic {
7
4
@@ -13,7 +10,7 @@ public static void main(String[] argv) throws Exception {
13
10
Connection connection = factory .newConnection ();
14
11
Channel channel = connection .createChannel ();
15
12
16
- channel .exchangeDeclare (EXCHANGE_NAME , "topic" );
13
+ channel .exchangeDeclare (EXCHANGE_NAME , BuiltinExchangeType . TOPIC );
17
14
String queueName = channel .queueDeclare ().getQueue ();
18
15
19
16
if (argv .length < 1 ) {
You can’t perform that action at this time.
0 commit comments