use of com.generallycloud.baseio.container.jms.TextMessage in project baseio by generallycloud.
the class TestTellerPower method main.
public static void main(String[] args) throws Exception {
LoggerFactory.configure();
SimpleIoEventHandle eventHandle = new SimpleIoEventHandle();
ServerConfiguration configuration = new ServerConfiguration(8300);
SocketChannelContext context = new NioSocketChannelContext(configuration);
SocketChannelConnector connector = new SocketChannelConnector(context);
context.setIoEventHandleAdaptor(eventHandle);
context.setProtocolFactory(new ProtobaseProtocolFactory());
context.addSessionEventListener(new LoggerSocketSEListener());
FixedSession session = new FixedSession(connector.connect());
session.login("admin", "admin100");
MessageProducer producer = new DefaultMessageProducer(session);
TextMessage message = new TextMessage("msgId", "qName", "你好!");
long old = System.currentTimeMillis();
for (int i = 0; i < 10000; i++) {
producer.offer(message);
}
System.out.println("Time:" + (System.currentTimeMillis() - old));
connector.close();
}
use of com.generallycloud.baseio.container.jms.TextMessage in project baseio by generallycloud.
the class TextMessageDecoder method decode.
@Override
public Message decode(ParamedProtobaseFuture future) {
Parameters param = future.getParameters();
String messageId = param.getParameter("msgId");
String queueName = param.getParameter("queueName");
String text = param.getParameter("text");
return new TextMessage(messageId, queueName, text);
}
use of com.generallycloud.baseio.container.jms.TextMessage in project baseio by generallycloud.
the class TestPublish method main.
public static void main(String[] args) throws Exception {
LoggerFactory.configure();
SimpleIoEventHandle eventHandle = new SimpleIoEventHandle();
ServerConfiguration configuration = new ServerConfiguration(8300);
SocketChannelContext context = new NioSocketChannelContext(configuration);
SocketChannelConnector connector = new SocketChannelConnector(context);
context.setIoEventHandleAdaptor(eventHandle);
context.setProtocolFactory(new ParamedProtobaseProtocolFactory());
context.addSessionEventListener(new LoggerSocketSEListener());
FixedSession session = new FixedSession(connector.connect());
session.login("admin", "admin100");
MessageProducer producer = new DefaultMessageProducer(session);
TextMessage message = new TextMessage("msgId", "qName", "你好!");
producer.publish(message);
connector.close();
}
use of com.generallycloud.baseio.container.jms.TextMessage in project baseio by generallycloud.
the class TestTeller method main.
public static void main(String[] args) throws Exception {
SimpleIoEventHandle eventHandle = new SimpleIoEventHandle();
SocketChannelContext context = new NioSocketChannelContext(new ServerConfiguration(8300));
SocketChannelConnector connector = new SocketChannelConnector(context);
context.setIoEventHandleAdaptor(eventHandle);
context.setProtocolFactory(new ParamedProtobaseProtocolFactory());
context.addSessionEventListener(new LoggerSocketSEListener());
FixedSession session = new FixedSession(connector.connect());
boolean b = session.login("admin", "admin100");
System.out.println(b);
MessageProducer producer = new DefaultMessageProducer(session);
TextMessage message = new TextMessage("msgId", "uuid", "你好!");
MapMessage mapMessage = new MapMessage("msgId", "uuid");
mapMessage.put("test", "test111111111111111111111");
long old = System.currentTimeMillis();
producer.offer(message);
producer.offer(mapMessage);
System.out.println("Time:" + (System.currentTimeMillis() - old));
connector.close();
}
Aggregations