gu.simplemq.BaseMQPublisher Maven / Gradle / Ivy
package gu.simplemq;
import java.util.Arrays;
import java.util.Collection;
import gu.simplemq.BaseMQSender;
import gu.simplemq.Channel;
import gu.simplemq.IPublisher;
import gu.simplemq.pool.BaseMQPool;
/**
*
* 基于{@link BaseMQSender}的{@link IPublisher} 抽象实现
* @author guyadong
*
*/
public abstract class BaseMQPublisher extends BaseMQSender implements IPublisher{
public BaseMQPublisher(BaseMQPool poolLazy) {
super(poolLazy);
}
@Override
public long publish(Channel channel, T object) {
doProduce(channel, Arrays.asList(object));
return 0L;
}
@Override
public void publish(Channel channel, Collection objects) {
doProduce(channel,objects);
}
@Override
public void publish(Channel channel, @SuppressWarnings("unchecked") T... objects) {
if(objects != null){
doProduce(channel, Arrays.asList(objects));
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy