use of com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.DeviceResponseMessageSender in project Protocol-Adapter-OSLP by OSGP.
the class OslpChannelHandlerClient method send.
public void send(final InetSocketAddress address, final OslpEnvelope request, final OslpResponseHandler responseHandler, final String deviceIdentification) throws IOException {
LOGGER.info("Sending OSLP request: {}", request.getPayloadMessage());
// Open connection and send message.
final ChannelFuture channelFuture = this.bootstrap.connect(address);
this.callbackHandlers.put(channelFuture.getChannel().getId(), new OslpCallbackHandler(responseHandler));
channelFuture.addListener(new ChannelFutureListener() {
@Autowired
protected DeviceResponseMessageSender responseMessageSender;
@Override
public void operationComplete(final ChannelFuture future) throws Exception {
if (future.isSuccess()) {
OslpChannelHandlerClient.this.write(future, address, request);
// What is this call below good for?
future.getChannel().getId();
} else {
LOGGER.info("The connection to the device {} is not successful", deviceIdentification);
throw new IOException("ChannelFuture - Unable to connect");
}
}
});
}
Aggregations