Search in sources :

Example 6 with MapMessage

use of com.generallycloud.baseio.container.jms.MapMessage in project baseio by generallycloud.

the class MapMessageDecoder method decode.

@Override
public Message decode(ParamedProtobaseFuture future) {
    Parameters param = future.getParameters();
    String messageId = param.getParameter("msgId");
    String queueName = param.getParameter("queueName");
    JSONObject map = param.getJSONObject("map");
    return new MapMessage(messageId, queueName, map);
}
Also used : Parameters(com.generallycloud.baseio.component.Parameters) JSONObject(com.alibaba.fastjson.JSONObject) MapMessage(com.generallycloud.baseio.container.jms.MapMessage)

Example 7 with MapMessage

use of com.generallycloud.baseio.container.jms.MapMessage 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();
}
Also used : SocketChannelConnector(com.generallycloud.baseio.connector.SocketChannelConnector) DefaultMessageProducer(com.generallycloud.baseio.container.jms.client.impl.DefaultMessageProducer) LoggerSocketSEListener(com.generallycloud.baseio.component.LoggerSocketSEListener) ServerConfiguration(com.generallycloud.baseio.configuration.ServerConfiguration) MapMessage(com.generallycloud.baseio.container.jms.MapMessage) FixedSession(com.generallycloud.baseio.container.FixedSession) SimpleIoEventHandle(com.generallycloud.baseio.container.SimpleIoEventHandle) SocketChannelContext(com.generallycloud.baseio.component.SocketChannelContext) NioSocketChannelContext(com.generallycloud.baseio.component.NioSocketChannelContext) NioSocketChannelContext(com.generallycloud.baseio.component.NioSocketChannelContext) DefaultMessageProducer(com.generallycloud.baseio.container.jms.client.impl.DefaultMessageProducer) MessageProducer(com.generallycloud.baseio.container.jms.client.MessageProducer) ParamedProtobaseProtocolFactory(com.generallycloud.baseio.codec.protobase.ParamedProtobaseProtocolFactory) TextMessage(com.generallycloud.baseio.container.jms.TextMessage)

Aggregations

MapMessage (com.generallycloud.baseio.container.jms.MapMessage)7 RTPException (com.generallycloud.baseio.container.rtp.RTPException)4 MQException (com.generallycloud.baseio.container.jms.MQException)3 Authority (com.generallycloud.baseio.container.authority.Authority)2 JSONObject (com.alibaba.fastjson.JSONObject)1 ParamedProtobaseProtocolFactory (com.generallycloud.baseio.codec.protobase.ParamedProtobaseProtocolFactory)1 ProtobaseFuture (com.generallycloud.baseio.codec.protobase.future.ProtobaseFuture)1 LoggerSocketSEListener (com.generallycloud.baseio.component.LoggerSocketSEListener)1 NioSocketChannelContext (com.generallycloud.baseio.component.NioSocketChannelContext)1 Parameters (com.generallycloud.baseio.component.Parameters)1 SocketChannelContext (com.generallycloud.baseio.component.SocketChannelContext)1 ServerConfiguration (com.generallycloud.baseio.configuration.ServerConfiguration)1 SocketChannelConnector (com.generallycloud.baseio.connector.SocketChannelConnector)1 FixedSession (com.generallycloud.baseio.container.FixedSession)1 SimpleIoEventHandle (com.generallycloud.baseio.container.SimpleIoEventHandle)1 MapByteMessage (com.generallycloud.baseio.container.jms.MapByteMessage)1 NullMessage (com.generallycloud.baseio.container.jms.NullMessage)1 TextByteMessage (com.generallycloud.baseio.container.jms.TextByteMessage)1 TextMessage (com.generallycloud.baseio.container.jms.TextMessage)1 MessageProducer (com.generallycloud.baseio.container.jms.client.MessageProducer)1