@SuppressWarnings("unchecked")
public static Message createCommandMessage(QueueSession session, String json) {
if (json.length() == 0) return null;
Message msg = createWithPartsFromRawMap(ErraiProtocolEnvelopeMarshaller.INSTANCE.demarshall(JSONDecoder.decode(json),
new DecodingSession(MappingContextSingleton.get())))
.setResource("Session", session)
.setResource("SessionID", session.getSessionId());
msg.setFlag(RoutingFlag.FromRemote);