Skip to content

Instantly share code, notes, and snippets.

@ddossot
Created February 9, 2015 23:42
Show Gist options
  • Save ddossot/af7bfb30341d19b321df to your computer and use it in GitHub Desktop.
Save ddossot/af7bfb30341d19b321df to your computer and use it in GitHub Desktop.
RxMule Java 8 Sample
rxMule
.observeEndpointAsync(new URI("http://localhost:8080/publish"))
.distinct(
muleEvent -> {
final String remoteAddressAndPort =
muleEvent
.getMessage()
.getInboundProperty(
"MULE_REMOTE_CLIENT_ADDRESS");
return substringBefore(remoteAddressAndPort, ":");
})
.subscribe(
asAction((MessageConsumer)
muleEvent -> {
redisModule.publish(
"http-requests",
false,
muleEvent.getMessageAsString(),
muleEvent);
LOGGER.info("Published: {}", muleEvent);
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment