Reactor AWS Client

Spring Reactor Wrapper around AWS Client

License

License

Categories

Categories

AWS Container PaaS Providers React User Interface Web Frameworks KeY Data Data Formats Formal Verification Reactor Microservices Reactive libraries
GroupId

GroupId

com.github.tddmonkey
ArtifactId

ArtifactId

reactor-aws-sns
Last Version

Last Version

0.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

Reactor AWS Client
Spring Reactor Wrapper around AWS Client
Project URL

Project URL

https://github.com/tddmonkey/reactor-aws
Source Code Management

Source Code Management

https://github.com/tddmonkey/reactor-aws

Download reactor-aws-sns

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.tddmonkey/reactor-aws-sns/ -->
<dependency>
    <groupId>com.github.tddmonkey</groupId>
    <artifactId>reactor-aws-sns</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.tddmonkey/reactor-aws-sns/
implementation 'com.github.tddmonkey:reactor-aws-sns:0.0.1'
// https://jarcasting.com/artifacts/com.github.tddmonkey/reactor-aws-sns/
implementation ("com.github.tddmonkey:reactor-aws-sns:0.0.1")
'com.github.tddmonkey:reactor-aws-sns:jar:0.0.1'
<dependency org="com.github.tddmonkey" name="reactor-aws-sns" rev="0.0.1">
  <artifact name="reactor-aws-sns" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.tddmonkey', module='reactor-aws-sns', version='0.0.1')
)
libraryDependencies += "com.github.tddmonkey" % "reactor-aws-sns" % "0.0.1"
[com.github.tddmonkey/reactor-aws-sns "0.0.1"]

Dependencies

compile (3)

Group / Artifact Type Version
com.github.tddmonkey : reactor-aws-common jar 0.0.1
io.projectreactor : reactor-core jar 3.0.6.RELEASE
com.amazonaws : aws-java-sdk-sns jar 1.11.118

Project Modules

There are no modules declared in this project.

reactor-aws

This project provides Spring Reactor abstractions over some of the AWS Java SDK

Supported SDKs

SQS

SNS

DynamoDb

Usage

All SDKs follow the same naming conventions, parameters and return types that the current clients do so that they can almost be used as a drop in replacement in your existing code. For example, if you have code that performs a synchronous listQueues request for SQS like this:

ListQueuesResult listQueuesResult = amazonClient.listQueues(new ListQueuesRequest());
listQueuesResult.getQueueUrls().forEach(System.out::println);

This can be turned into an Rx call like this:

AmazonSdkReactorSqs reactorSqs = new AmazonSdkReactorSqs(amazonClient);
reactorSqs.listQueues(new ListQueuesRequest())
	.flatMapIterable(listQueuesResult -> listQueuesResult.getQueueUrls())
	.subscribe(System.out::println);

To receive messages, a synchronous call of this:

ReceiveMessageRequest request = new ReceiveMessageRequest()
	.withQueueUrl(queueUrl)
	.withMaxNumberOfMessages(1);
ReceiveMessageResult receiveMessageResult = amazonClient.receiveMessage(request);
receiveMessageResult.getMessages()
	.stream()
	.map(message -> message.getBody())
	.forEach(System.out::println);

Would become this:

AmazonSdkReactorSqs reactorSqs = new AmazonSdkReactorSqs(amazonClient);
ReceiveMessageRequest request = new ReceiveMessageRequest()
	.withQueueUrl(queueUrl)
	.withMaxNumberOfMessages(1);
reactorSqs.receiveMessage(request)
	.flatMapIterable(receiveMessageResult -> receiveMessageResult.getMessages())
	.map(message -> message.getBody())
	.subscribe(System.out::println);

The Reactor client must be instantiated with an Async version of the AWS SDK being used as the Reactor code performs an asynchronous call on your behalf. Under the hood this is just a call to the relevant aws async method with a relevant Reactor handler. For example, using the aws async interface for listing queues, the code would be like this:

amazonClient.listQueuesAsync(new ListQueuesRequest(), new AsyncHandler<ListQueuesRequest, ListQueuesResult>() {
	@Override
	public void onError(Exception exception) {
		// handle errors here
	}

	@Override
	public void onSuccess(ListQueuesRequest request, ListQueuesResult listQueuesResult) {
		// handle success here
	}
});

whereas with this library the call is a standard Reactor chain:

reactorSqs.listQueues(new ListQueuesRequest())
	.doOnError(t -> handleErrorsHere())
	.subscribe(listQueuesResult -> handleSuccessHere());

Building

The project is built using the Gradle wrapper and requires Java 1.8

Where are the tests?!

The code here is all fully generated and has no tests. If you want to know more about the code generation see The Generator Project

Versions

Version
0.0.1