/**
 * @author effine
 * @Date 2016年1月5日  下午6:22:20
 * @email verphen#gmail.com
 * @site http://www.effine.cn
 */

package cn.effine.lab.rabbitmq;

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

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

public abstract class EndPoint {
	protected Channel channel;
	protected Connection connection;
	protected String endPointName;

	public EndPoint(String endpointName) throws IOException {
		this.endPointName = endpointName;

		// Create a connection factory
		ConnectionFactory factory = new ConnectionFactory();

		// 配置rabbitmq服务的连接信息
		factory.setHost("localhost");
		factory.setUsername("");
		factory.setPassword("");
		

		try {
			connection = factory.newConnection();
		} catch (TimeoutException e) {
			e.printStackTrace();
		}

		// creating a channel
		channel = connection.createChannel();

		// declaring a queue for this channel. If queue does not exist,
		// it will be created on the server.
		channel.queueDeclare(endpointName, false, false, false, null);
	}
}

@@ -700,16 +700,26 @@
 q%E6%9C%8D%E5%8A%A1%E7%9A%84%E8%BF%9E%E6%8E%A5%E4%BF%A1%E6%81%AF
+(%E5%8F%AA%E9%9C%80%E9%85%8D%E7%BD%AE%E4%B8%BB%E6%9C%BA%E5%8D%B3%E5%8F%AF)
 %0D%0A%09%09fact
@@ -748,68 +748,8 @@
 %22);%0D
-%0A%09%09factory.setUsername(%22%22);%0D%0A%09%09factory.setPassword(%22%22);%0D%0A%09%09%0D
 %0A%0D%0A%09

debug success for rabbitmq