use of com.roof.chain.support.GenericValueStack in project roof-im by madfroglx.
the class WebSocketRequestEnterPoint method receive.
@Override
public void receive(String sessionID, String message) {
ValueStack valueStack = new GenericValueStack();
valueStack.set(ImConstant.TEXT_MESSAGE, message);
valueStack.set(ImConstant.CONNECT_ID, sessionID);
JSONObject jsonObjectMessage;
try {
jsonObjectMessage = JSON.parseObject(message);
} catch (Exception e) {
LOGGER.error("input json error: {}", message);
return;
}
valueStack.set(ImConstant.JSON_OBJECT_MESSAGE, jsonObjectMessage);
try {
enterChain.doChain(valueStack);
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
}
}
use of com.roof.chain.support.GenericValueStack in project roof-im by madfroglx.
the class AbstractBlockingQueueRequestMessageDriveEnterPoint method subscribe.
@Override
public void subscribe(E message) {
ValueStack valueStack = new GenericValueStack();
valueStack.set(ImConstant.MESSAGE, message);
try {
chain.doChain(valueStack);
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
}
}
use of com.roof.chain.support.GenericValueStack in project roof-im by madfroglx.
the class MessageRequestTest method testSuccess.
@Test
public void testSuccess() throws Exception {
online("bcd");
MessageRequest messageRequest = new MessageRequest();
messageRequest.setRequestType("message");
messageRequest.setToken("abc");
messageRequest.setReceiver("bcd");
messageRequest.setType(ContentType.TXT);
messageRequest.setClientType(ClientType.h5.name());
messageRequest.setCreateTime(System.currentTimeMillis());
messageRequest.setPayload("test");
ValueStack valueStack = new GenericValueStack();
valueStack.set(ImConstant.TEXT_MESSAGE, JSON.toJSONString(messageRequest));
valueStack.set(ImConstant.CONNECT_ID, "1");
valueStack.set("messageRequest", messageRequest);
messageRequestChain.doChain(valueStack);
}
use of com.roof.chain.support.GenericValueStack in project roof-im by madfroglx.
the class RequestTest method online.
public void online(String token) throws Exception {
UserStateRequest userStateRequest = new UserStateRequest();
userStateRequest.setClientType(ClientType.h5.name());
userStateRequest.setRequestType("online");
userStateRequest.setToken(token);
ValueStack valueStack = new GenericValueStack();
System.out.println(JSON.toJSONString(userStateRequest));
valueStack.set(ImConstant.TEXT_MESSAGE, JSON.toJSONString(userStateRequest));
valueStack.set(ImConstant.CONNECT_ID, "1");
JSONObject jsonObjectMessage = JSON.parseObject(JSON.toJSONString(userStateRequest));
valueStack.set(ImConstant.JSON_OBJECT_MESSAGE, jsonObjectMessage);
enterChain.doChain(valueStack);
}
use of com.roof.chain.support.GenericValueStack in project roof-im by madfroglx.
the class MessageTest method testSuccess.
@Test
public void testSuccess() throws Exception {
online("bcd");
online("abc");
MessageRequest messageRequest = new MessageRequest();
messageRequest.setRequestType("message");
messageRequest.setToken("abc");
messageRequest.setReceiver("abc");
messageRequest.setType(ContentType.TXT);
messageRequest.setClientType(ClientType.h5.name());
messageRequest.setCreateTime(System.currentTimeMillis());
messageRequest.setPayload("test");
System.out.println(JSON.toJSONString(messageRequest));
ValueStack valueStack = new GenericValueStack();
valueStack.set(ImConstant.TEXT_MESSAGE, JSON.toJSONString(messageRequest));
valueStack.set(ImConstant.CONNECT_ID, "1");
JSONObject jsonObjectMessage = JSON.parseObject(JSON.toJSONString(messageRequest));
valueStack.set(ImConstant.JSON_OBJECT_MESSAGE, jsonObjectMessage);
enterChain.doChain(valueStack);
}
Aggregations