use of com.generallycloud.baseio.container.jms.Message in project baseio by generallycloud.
the class TestTransaction method commit.
static void commit(MessageConsumer consumer) throws MQException {
long old = System.currentTimeMillis();
consumer.beginTransaction();
consumer.receive(new OnMessage() {
@Override
public void onReceive(Message message) {
System.out.println(message);
}
});
consumer.commit();
System.out.println("Time:" + (System.currentTimeMillis() - old));
}
use of com.generallycloud.baseio.container.jms.Message in project baseio by generallycloud.
the class MQProducerServlet method doAccept.
@Override
public void doAccept(SocketSession session, ParamedProtobaseFuture future, MQSessionAttachment attachment) throws Exception {
MQContext context = getMQContext();
Message message = context.parse(future);
context.offerMessage(message);
future.write("1");
session.flush(future);
}
use of com.generallycloud.baseio.container.jms.Message in project baseio by generallycloud.
the class MQPublishServlet method doAccept.
@Override
public void doAccept(SocketSession session, ParamedProtobaseFuture future, MQSessionAttachment attachment) throws Exception {
MQContext context = getMQContext();
Message message = context.parse(future);
context.publishMessage(message);
future.write("1");
session.flush(future);
}
use of com.generallycloud.baseio.container.jms.Message in project baseio by generallycloud.
the class P2PProductLine method doLoop.
// FIXME 完善消息匹配机制
@Override
public void doLoop() {
Message message = storage.poll(16);
if (message == null) {
return;
}
String queueName = message.getQueueName();
ConsumerQueue consumerQueue = getConsumerQueue(queueName);
List<Consumer> consumers = consumerQueue.getSnapshot();
if (consumers.size() == 0) {
filterUseless(message);
return;
}
for (Consumer consumer : consumers) {
try {
consumer.push(message);
} catch (IOException e) {
logger.error(e.getMessage(), e);
this.offerMessage(message);
}
}
context.consumerMessage(message);
}
use of com.generallycloud.baseio.container.jms.Message in project baseio by generallycloud.
the class SubscribeProductLine method doLoop.
// FIXME 完善消息匹配机制
@Override
public void doLoop() {
Message message = storage.poll(16);
if (message == null) {
return;
}
String queueName = message.getQueueName();
ConsumerQueue consumerQueue = getConsumerQueue(queueName);
List<Consumer> consumers = consumerQueue.getSnapshot();
if (consumers.size() == 0) {
return;
}
for (Consumer consumer : consumers) {
try {
consumer.push(message);
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
}
context.consumerMessage(message);
}
Aggregations