???????????£??????????????????????????????????е??
Channel channel = new Channel();
channel.queueDeclare(QUEUE_NAME?? true?? false?? false?? null);
int prefetchCount = 1;
channel.basicQos(prefetchCount);
byte[] bytes = message.getBytes("UTF-8");
channel.basicPublish(""??bytes);
?????????????Channel?????????????????????????????????????С?????Щ????£?????????
??????????????????????????????
public class Channel {
private int basicQos=0;
private AMQP.Queue queue;
public Channel()
{}
public Channel basicQos(int preCnt)
{
this.basicQos=preCnt;
return this;
}
public Channel queueDeclare(String queue?? boolean durable?? boolean exclusive?? boolean autoDelete??
Map<String?? Object> arguments)
{
this.queue=createQueue();
return this;
}
private AMQP.Queue createQueue()
{
return new AMQP.Queue();
}
public void  basicPublish(String exchange??byte[] bytes)
{
//doSomething
}
}
???????????????????????????????磺
????@Test
????public void testChannel()
????{
????new Channel().basicQos(1).queueDeclare(""??true??false??false??null).basicPublish(""??new byte[]{1??3??4});
????}