INT-4279: Document UDP Java Configuration

JIRA: https://jira.spring.io/browse/INT-4279

Add documentation for Java configuration of UDP channel adapters.
Enhance DSL to support host/port for outbound adapters.
This commit is contained in:
Gary Russell
2017-10-30 13:39:19 -04:00
committed by Artem Bilan
parent 6d96914c1f
commit 06aa45e91f
5 changed files with 139 additions and 39 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,6 +40,10 @@ public abstract class AbstractUdpOutboundChannelAdapterSpec<S extends AbstractUd
super();
}
protected AbstractUdpOutboundChannelAdapterSpec(String host, int port) {
this.target = new UnicastSendingMessageHandler(host, port);
}
AbstractUdpOutboundChannelAdapterSpec(String destinationExpression) {
this.target = new UnicastSendingMessageHandler(destinationExpression);
}

View File

@@ -54,7 +54,17 @@ public final class Udp {
}
/**
* Create an inbound unicast channel adapter using the supplied destination
* Create an outbound unicast channel adapter using the supplied host and port.
* @param host the host.
* @param port the port.
* @return the spec.
*/
public static UdpUnicastOutboundChannelAdapterSpec outboundAdapter(String host, int port) {
return new UdpUnicastOutboundChannelAdapterSpec(host, port);
}
/**
* Create an outbound unicast channel adapter using the supplied destination
* expression.
* @param destinationExpression destination expression.
* @return the spec.
@@ -64,7 +74,7 @@ public final class Udp {
}
/**
* Create an inbound unicast channel adapter using the supplied destination
* Create an outbound unicast channel adapter using the supplied destination
* expression.
* @param destinationFunction function that will provide the destination based on the message.
* @return the spec.
@@ -74,7 +84,17 @@ public final class Udp {
}
/**
* Create an inbound multicast channel adapter using the supplied destination
* Create an outbound multicast channel adapter using the supplied host and port.
* @param host the host.
* @param port the port.
* @return the spec.
*/
public static UdpMulticastOutboundChannelAdapterSpec outboundMulticastAdapter(String host, int port) {
return new UdpMulticastOutboundChannelAdapterSpec(host, port);
}
/**
* Create an outbound multicast channel adapter using the supplied destination
* expression.
* @param destinationExpression destination expression.
* @return the spec.
@@ -84,7 +104,7 @@ public final class Udp {
}
/**
* Create an inbound multicast channel adapter using the supplied destination
* Create an outbound multicast channel adapter using the supplied destination
* expression.
* @param destinationFunction function that will provide the destination based on the message.
* @return the spec.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,6 +33,10 @@ import org.springframework.messaging.Message;
public class UdpMulticastOutboundChannelAdapterSpec
extends AbstractUdpOutboundChannelAdapterSpec<UdpMulticastOutboundChannelAdapterSpec> {
UdpMulticastOutboundChannelAdapterSpec(String host, int port) {
this.target = new MulticastSendingMessageHandler(host, port);
}
UdpMulticastOutboundChannelAdapterSpec(String destinationExpression) {
this.target = new MulticastSendingMessageHandler(destinationExpression);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,6 +32,10 @@ import org.springframework.messaging.Message;
public class UdpUnicastOutboundChannelAdapterSpec
extends AbstractUdpOutboundChannelAdapterSpec<UdpUnicastOutboundChannelAdapterSpec> {
UdpUnicastOutboundChannelAdapterSpec(String host, int port) {
super(host, port);
}
UdpUnicastOutboundChannelAdapterSpec(Function<Message<?>, ?> destinationFunction) {
super(destinationFunction);
}