super(Phase.PRE_INVOKE);
}
public void handleMessage(Message message) {
try {
MessageExchange exchange;
NormalizedMessage nm;
// Create message
if (!isRequestor(message)) {
exchange = createExchange(message);
nm = exchange.createMessage();
exchange.setMessage(nm, "in");
message.setContent(MessageExchange.class, exchange);
} else {
exchange = message.getContent(MessageExchange.class);
if (exchange == null) {
throw new IllegalStateException("Content of type "
+ MessageExchange.class + " not found on message");
}
if (message.getContent(Exception.class) == null) {
nm = exchange.createMessage();
exchange.setMessage(nm, "out");
} else {
exchange.setFault(exchange.createFault());
nm = exchange.getFault();
}
}
// Put headers
toNMSHeaders(nm, message);
// Put attachments