use of quickfix.Session in project camel by apache.
the class QuickfixjEventJsonTransformer method transform.
public String transform(Exchange exchange) {
SessionID sessionID = exchange.getIn().getHeader(QuickfixjEndpoint.SESSION_ID_KEY, SessionID.class);
Session session = Session.lookupSession(sessionID);
DataDictionary dataDictionary = session.getDataDictionary();
if (dataDictionary == null) {
throw new IllegalStateException("No Data Dictionary. Exchange must reference an existing session");
}
StringBuilder sb = new StringBuilder();
sb.append("\"event\": {\n");
org.apache.camel.Message in = exchange.getIn();
for (String key : in.getHeaders().keySet()) {
sb.append(" \"").append(key).append("\": ").append(in.getHeader(key)).append(",\n");
}
sb.append(renderer.transform(in.getBody(Message.class), " ", dataDictionary)).append("\n");
sb.append("}\n");
return sb.toString();
}
use of quickfix.Session in project camel by apache.
the class QuickfixjMessageJsonTransformer method transform.
public String transform(Message message) throws FieldNotFound, ConfigError {
SessionID sessionID = MessageUtils.getSessionID(message);
Session session = Session.lookupSession(sessionID);
DataDictionary dataDictionary = session.getDataDictionary();
if (dataDictionary == null) {
throw new IllegalStateException("No Data Dictionary. Exchange must reference an existing session");
}
return transform(message, dataDictionary);
}
Aggregations