lb ENvoyerDate
This commit is contained in:
@@ -5,10 +5,11 @@ import java.util.Date;
|
|||||||
import com.rabbitmq.client.Channel;
|
import com.rabbitmq.client.Channel;
|
||||||
import com.rabbitmq.client.Connection;
|
import com.rabbitmq.client.Connection;
|
||||||
import com.rabbitmq.client.ConnectionFactory;
|
import com.rabbitmq.client.ConnectionFactory;
|
||||||
|
import com.rabbitmq.client.MessageProperties;
|
||||||
|
|
||||||
|
|
||||||
public class EnvoyerDate {
|
public class EnvoyerDate {
|
||||||
private static final String EXCHANGE_NAME = "logs";
|
private static final String EXCHANGE_NAME = "file_date";
|
||||||
|
|
||||||
public static void main(String[] argv) throws Exception {
|
public static void main(String[] argv) throws Exception {
|
||||||
ConnectionFactory factory = new ConnectionFactory();
|
ConnectionFactory factory = new ConnectionFactory();
|
||||||
@@ -20,12 +21,10 @@ public class EnvoyerDate {
|
|||||||
|
|
||||||
while(true){
|
while(true){
|
||||||
|
|
||||||
channel.exchangeDeclare(EXCHANGE_NAME, "fanout");
|
|
||||||
|
|
||||||
String message = argv.length < 1 ? getDate()
|
String message = argv.length < 1 ? getDate()
|
||||||
: String.join(" ", argv);
|
: String.join(" ", argv);
|
||||||
|
|
||||||
channel.basicPublish(EXCHANGE_NAME, "", null, message.getBytes("UTF-8"));
|
channel.basicPublish("",EXCHANGE_NAME, MessageProperties.PERSISTENT_TEXT_PLAIN, message.getBytes("UTF-8"));
|
||||||
System.out.println(" [x] Sent '" + message + "'");
|
System.out.println(" [x] Sent '" + message + "'");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user