final String address = to.getValue();
LOG.log(Level.FINE, "Resending to address: {0}", address);
final ProtocolVariation protocol = RMContextUtils.getProtocolVariation(message);
final Endpoint reliableEndpoint = manager.getReliableEndpoint(message).getEndpoint(protocol);
ConduitSelector cs = new DeferredConduitSelector() {
@Override
public synchronized Conduit selectConduit(Message message) {
Conduit conduit = null;
EndpointInfo endpointInfo = reliableEndpoint.getEndpointInfo();
EndpointReferenceType original = endpointInfo.getTarget();
try {
if (null != address) {
endpointInfo.setAddress(address);
}
conduit = super.selectConduit(message);
} finally {
endpointInfo.setAddress(original);
}
return conduit;
}
};
cs.setEndpoint(reliableEndpoint);
Conduit c = cs.selectConduit(message);
// REVISIT
// use application endpoint message observer instead?
c.setMessageObserver(new MessageObserver() {
public void onMessage(Message message) {
LOG.fine("Ignoring response to resent message.");