use of com.generallycloud.baseio.container.jms.client.impl.DefaultMessageConsumer in project baseio by generallycloud.
the class TestSubscribe method test.
private static void test() 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");
MessageConsumer consumer = new DefaultMessageConsumer(session);
consumer.subscribe(new OnMessage() {
@Override
public void onReceive(Message message) {
System.out.println(message);
}
});
connector.close();
}
Aggregations