/** * Join a multicast group. * * @param multicastAddress multicast address of the group to join * * @return a {@link Publisher} that will be complete when the group has been joined */ @Override public Mono<Void> join(final InetAddress multicastAddress, NetworkInterface iface) { if (null == iface && null != datagramChannel.config().getNetworkInterface()) { iface = datagramChannel.config().getNetworkInterface(); } final ChannelFuture future; if (null != iface) { future = datagramChannel.joinGroup(new InetSocketAddress(multicastAddress, datagramChannel.localAddress() .getPort()), iface); } else { future = datagramChannel.joinGroup(multicastAddress); } return FutureMono.from(future) .doOnSuccess(v -> log.info(format(future.channel(), "JOIN {}"), multicastAddress)); }
/** * Leave a multicast group. * * @param multicastAddress multicast address of the group to leave * * @return a {@link Publisher} that will be complete when the group has been left */ @Override public Mono<Void> leave(final InetAddress multicastAddress, NetworkInterface iface) { if (null == iface && null != datagramChannel.config().getNetworkInterface()) { iface = datagramChannel.config().getNetworkInterface(); } final ChannelFuture future; if (null != iface) { future = datagramChannel.leaveGroup(new InetSocketAddress(multicastAddress, datagramChannel.localAddress() .getPort()), iface); } else { future = datagramChannel.leaveGroup(multicastAddress); } return FutureMono.from(future) .doOnSuccess(v -> log.info(format(future.channel(), "JOIN {}"), multicastAddress)); }
/** * Join a multicast group. * * @param multicastAddress multicast address of the group to join * * @return a {@link Publisher} that will be complete when the group has been joined */ @Override public Mono<Void> join(final InetAddress multicastAddress, NetworkInterface iface) { if (null == iface && null != datagramChannel.config().getNetworkInterface()) { iface = datagramChannel.config().getNetworkInterface(); } final ChannelFuture future; if (null != iface) { future = datagramChannel.joinGroup(new InetSocketAddress(multicastAddress, datagramChannel.localAddress() .getPort()), iface); } else { future = datagramChannel.joinGroup(multicastAddress); } return FutureMono.from(future) .doOnSuccess(v -> log.info("JOIN {}", multicastAddress)); }
/** * Join a multicast group. * * @param multicastAddress multicast address of the group to join * * @return a {@link Publisher} that will be complete when the group has been joined */ @Override public Mono<Void> join(final InetAddress multicastAddress, NetworkInterface iface) { if (null == iface && null != datagramChannel.config().getNetworkInterface()) { iface = datagramChannel.config().getNetworkInterface(); } final ChannelFuture future; if (null != iface) { future = datagramChannel.joinGroup(new InetSocketAddress(multicastAddress, datagramChannel.localAddress() .getPort()), iface); } else { future = datagramChannel.joinGroup(multicastAddress); } return FutureMono.from(future) .doOnSuccess(v -> log.info(format(future.channel(), "JOIN {}"), multicastAddress)); }
/** * Leave a multicast group. * * @param multicastAddress multicast address of the group to leave * * @return a {@link Publisher} that will be complete when the group has been left */ @Override public Mono<Void> leave(final InetAddress multicastAddress, NetworkInterface iface) { if (null == iface && null != datagramChannel.config().getNetworkInterface()) { iface = datagramChannel.config().getNetworkInterface(); } final ChannelFuture future; if (null != iface) { future = datagramChannel.leaveGroup(new InetSocketAddress(multicastAddress, datagramChannel.localAddress() .getPort()), iface); } else { future = datagramChannel.leaveGroup(multicastAddress); } return FutureMono.from(future) .doOnSuccess(v -> log.info("JOIN {}", multicastAddress)); }
/** * Leave a multicast group. * * @param multicastAddress multicast address of the group to leave * * @return a {@link Publisher} that will be complete when the group has been left */ @Override public Mono<Void> leave(final InetAddress multicastAddress, NetworkInterface iface) { if (null == iface && null != datagramChannel.config().getNetworkInterface()) { iface = datagramChannel.config().getNetworkInterface(); } final ChannelFuture future; if (null != iface) { future = datagramChannel.leaveGroup(new InetSocketAddress(multicastAddress, datagramChannel.localAddress() .getPort()), iface); } else { future = datagramChannel.leaveGroup(multicastAddress); } return FutureMono.from(future) .doOnSuccess(v -> log.info(format(future.channel(), "JOIN {}"), multicastAddress)); }