Add sender service to customize sending messages
Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
@@ -95,7 +95,6 @@ public final class IpUtil {
|
||||
if (isIpV6) {
|
||||
return URI.create(scheme + SCHEME_SEPERATOR + "[" + host + "]");
|
||||
}
|
||||
|
||||
return URI.create(scheme + SCHEME_SEPERATOR + host);
|
||||
}
|
||||
|
||||
@@ -108,8 +107,9 @@ public final class IpUtil {
|
||||
* @throws IllegalArgumentException
|
||||
* If the given string not parsable
|
||||
*/
|
||||
public static URI createAmqpUri(final String host) {
|
||||
return createUri(AMPQP_SCHEME, host);
|
||||
public static URI createAmqpUri(final String virtualHost, final String exchange) {
|
||||
// TODO check
|
||||
return createUri(AMPQP_SCHEME, virtualHost).resolve(exchange);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -104,23 +104,24 @@ public class IpUtilTest {
|
||||
@Description("Tests create amqp uri ipv4 and ipv6")
|
||||
public void testCreateAmqpUri() {
|
||||
final String ipv4 = "10.99.99.1";
|
||||
URI amqpUri = IpUtil.createAmqpUri(ipv4);
|
||||
URI amqpUri = IpUtil.createAmqpUri(ipv4, "path");
|
||||
assertAmqpUri(ipv4, amqpUri);
|
||||
|
||||
final String host = "myhost";
|
||||
amqpUri = IpUtil.createAmqpUri(host);
|
||||
amqpUri = IpUtil.createAmqpUri(host, "path");
|
||||
assertAmqpUri(host, amqpUri);
|
||||
|
||||
final String ipv6 = "0:0:0:0:0:0:0:1";
|
||||
amqpUri = IpUtil.createAmqpUri(ipv6);
|
||||
amqpUri = IpUtil.createAmqpUri(ipv6, "path");
|
||||
assertAmqpUri("[" + ipv6 + "]", amqpUri);
|
||||
}
|
||||
|
||||
private void assertAmqpUri(final String host, final URI httpUri) {
|
||||
assertTrue(IpUtil.isAmqpUri(httpUri));
|
||||
assertFalse(IpUtil.isHttpUri(httpUri));
|
||||
assertEquals(host, httpUri.getHost());
|
||||
assertEquals("amqp", httpUri.getScheme());
|
||||
private void assertAmqpUri(final String host, final URI amqpUri) {
|
||||
assertTrue(IpUtil.isAmqpUri(amqpUri));
|
||||
assertFalse(IpUtil.isHttpUri(amqpUri));
|
||||
assertEquals(host, amqpUri.getHost());
|
||||
assertEquals("amqp", amqpUri.getScheme());
|
||||
assertEquals("path", amqpUri.getPath());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
|
||||
Reference in New Issue
Block a user