Skip to content
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.

Latest commit

 

History

History
63 lines (47 loc) · 2.75 KB

README.md

File metadata and controls

63 lines (47 loc) · 2.75 KB

Cherami Client for JVM

(This project is deprecated and not maintained.)

Java client library for publishing/consuming messages to/from Cherami.

Build Status Coverage Status License: MIT

Using cherami-client-java

The cherami-client-java library supports publishing/consuming from Cherami in synchronous and asynchronous modes. The usage below uses the synchronous blocking API.

 // Create the client object with the server ip and port
 CheramiClient client = new CheramiClient.Builder(serverIP, serverPort).build();
 
 // Create a destination for publishing messages to
 CreateDestinationRequest dstRequest = new CreateDestinationRequest();
 dstRequest.setPath(destinationPath);
 client.createDestination(dstRequest);
 
 // Create a consumer group for consuming messages from the destination
 CreateConsumerGroupRequest cgRequest = new CreateConsumerGroupRequest();
 cgRequest.setDestinationPath(destinationPath);
 cgRequest.setConsumerGroupName(consumerGroupName);
 client.createConsumerGroup(cgRequest);
 
 // Publish a message
 CreatePublisherRequest pRequest = new CreatePublisherRequest.Builder(destinationPath).build()
 CheramiPublisher publisher = client.createPublisher(pRequest);
 publisher.open();
 publisher.write(new PublisherMessage("hello".getBytes("UTF8")));
 publisher.close();
 
 // Consume a message
 CreateConsumerRequest cRequest = new CreateConsumerRequest.Builder(destinationPath, consumerGroupName).build()
 CheramiConsumer consumer = client.createConsumer(cRequest);
 consumer.open();
 CheramiDelivery delivery = consumer.read();
 System.out.println(new String(delivery.getMessage().getPayload().getData(), "UTF8"));
 consumer.close();
 
 client.close();

For details on how to use the library in an application, see the examples directory.

Development

Build with mvn clean package

Contributing to Cherami

If you are interested in contributing to cherami the best place to start would be this blog post eng.uber.com/cherami

Note: All contributors also need to fill out the Uber Contributor License Agreement before we can merge in any of your changes.

Documentation

eng.uber.com/cherami

License

MIT License, please see LICENSE for details.