package br.com.producer.testes;

import java.io.IOException;
import java.net.ConnectException;
import java.util.concurrent.TimeoutException;

import br.com.producer.AppUtils;
import br.com.producer.mocks.seeds.JsonExampleSeed;
import br.com.producer.sender.IMessageSender;
import br.com.producer.sender.MessageSender;

public class EnviarMensagensFilaTest {


	private final static String QUEUE_NAME = "task_queue";
	private final static String HOST_NAME = "localhost";
	
	JsonExampleSeed message = new JsonExampleSeed();
	
	private IMessageSender sender1 = new MessageSender(QUEUE_NAME, HOST_NAME);
	private MessageSender sender2 = new MessageSender(QUEUE_NAME, HOST_NAME);
	
	public void enviarMensagens() 
			throws ConnectException, IOException, TimeoutException, IllegalArgumentException {
		// teste 1
		sender1.send(message.getExemploJson()); 
		
		// teste 2
		sender2.setMessage(AppUtils.toJsonObject("Testando envio de string como JSON ... ! "));
		sender2.send(); 
	}	
}

{'avg_line_length': 29.757575757575758, 'max_line_length': 89, 'alphanum_fraction': 0.7841140529531568, 'licenses': ['MIT'], 'repository_name': 'thiagosperandio/RabbitMQ-Producer', 'path': 'src/main/java/br/com/producer/testes/EnviarMensagensFilaTest.java', 'size': 982, 'lang': 'Java'}