Fixed sagan page for Azure and added additional test to RoutingFunctionTests
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
Spring Cloud Stream is a framework for building highly scalable event-driven microservices connected with shared messaging systems.
|
||||
|
||||
The framework provides flexible programming model built on already established and familiar Spring idioms and best practices, including support
|
||||
The framework provides flexible programming model built on already established and familiar Spring idioms and best practices, including support
|
||||
for persistent pub/sub semantics, consumer groups, and stateful partitions.
|
||||
|
||||
## Binder Implementations
|
||||
@@ -13,7 +13,7 @@ Spring Cloud Stream supports a variety of binder implementations and the followi
|
||||
* https://github.com/spring-cloud/spring-cloud-stream-binder-aws-kinesis[Amazon Kinesis]
|
||||
* https://github.com/spring-cloud/spring-cloud-gcp/tree/master/spring-cloud-gcp-pubsub-stream-binder[Google PubSub _(partner maintained)_]
|
||||
* https://github.com/SolaceProducts/spring-cloud-stream-binder-solace[Solace PubSub+ _(partner maintained)_]
|
||||
* https://github.com/Microsoft/spring-cloud-azure/tree/master/spring-cloud-azure-eventhub-stream-binder[Azure Event Hubs _(partner maintained)_]
|
||||
* https://github.com/microsoft/spring-cloud-azure/tree/master/spring-cloud-azure-stream-binder/spring-cloud-azure-eventhubs-stream-binder[Azure Event Hubs _(partner maintained)_]
|
||||
|
||||
The core building blocks of Spring Cloud Stream are:
|
||||
|
||||
|
||||
@@ -136,6 +136,59 @@ public class RoutingFunctionTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompositionViaFunctionName() {
|
||||
|
||||
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
|
||||
TestChannelBinderConfiguration.getCompleteConfiguration(
|
||||
RoutingFunctionConfiguration.class))
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.jmx.enabled=false",
|
||||
"--spring.cloud.stream.function.definition=router")) {
|
||||
|
||||
InputDestination inputDestination = context.getBean(InputDestination.class);
|
||||
OutputDestination outputDestination = context
|
||||
.getBean(OutputDestination.class);
|
||||
|
||||
Message<byte[]> inputMessage = MessageBuilder
|
||||
.withPayload("Hello".getBytes())
|
||||
.setHeader("function.name", "echo|uppercase")
|
||||
.setHeader(MessageHeaders.CONTENT_TYPE, MimeTypeUtils.TEXT_PLAIN)
|
||||
.build();
|
||||
inputDestination.send(inputMessage);
|
||||
|
||||
Message<byte[]> outputMessage = outputDestination.receive();
|
||||
assertThat(outputMessage.getPayload()).isEqualTo("HELLO".getBytes());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testPojoFunction() {
|
||||
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
|
||||
TestChannelBinderConfiguration.getCompleteConfiguration(
|
||||
RoutingFunctionConfiguration.class))
|
||||
.web(WebApplicationType.NONE)
|
||||
.run("--spring.jmx.enabled=false",
|
||||
"--spring.cloud.stream.function.definition=router")) {
|
||||
|
||||
InputDestination inputDestination = context.getBean(InputDestination.class);
|
||||
OutputDestination outputDestination = context
|
||||
.getBean(OutputDestination.class);
|
||||
|
||||
Message<byte[]> inputMessage = MessageBuilder
|
||||
.withPayload("{\"name\":\"bob\"}".getBytes())
|
||||
.setHeader("function.name", "pojoecho")
|
||||
.build();
|
||||
inputDestination.send(inputMessage);
|
||||
|
||||
Message<byte[]> outputMessage = outputDestination.receive();
|
||||
assertThat(outputMessage.getPayload()).isEqualTo("{\"name\":\"bob\"}".getBytes());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExplicitRoutingFunctionBindingWithCompositionAndRoutingEnabledExplicitly() {
|
||||
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
|
||||
@@ -239,6 +292,14 @@ public class RoutingFunctionTests {
|
||||
};
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Function<Person, Person> pojoecho() {
|
||||
return x -> {
|
||||
System.out.println("===> pojoecho");
|
||||
return x;
|
||||
};
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Function<Flux<String>, Flux<String>> echoFlux() {
|
||||
return flux -> flux.map(x -> {
|
||||
@@ -271,4 +332,16 @@ public class RoutingFunctionTests {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private static class Person {
|
||||
private String name;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user