How to Use Alibaba Cloud LOG Java Producer

Background

Procedure

Create Producer

ProjectConfig

Service Endpoint

Access Credential

ProjectConfigs

ProducerConfig

LogProducer

Producer producer = new LogProducer(producerConfig);

Send Data

Parameter description

Obtain the Data-Sending Result

Future

ListenableFuture<Result> f = producer.send("project", "logStore", logItem);
Futures.addCallback(f,
new FutureCallback<Result>() {
@Override
public void onSuccess(@Nullable Result result) {
}
@Override
public void onFailure(Throwable t) {
}
},
EXECUTOR_SERVICE);

Callback

producer.send(
"project",
"logStore",
logItem,
new Callback() {
@Override
public void onCompletion(Result result) {
}
});

Comparison between Future and Callback

Shut down the Producer

Safe Shutdown

Limited Shutdown

Sample Application

Original Source

--

--

--

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

02-Python-Function(Datacamp)

Democratizing Service Automation

Democratize Service automation

Systematic Solution for Android Native Memory Leak

Using Universal Composability to Implement Off-Chain Payment Channels: Appendix

3 useful product analytics tracking plan templates

Min Elevator Trips — Puzzle for Interview rounds

Accelerate Your Modelling, Reporting & Development with Pandas

Diving through the shell: the command interpreter 🤿

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

More from Medium

Spring Cloud Netflix

Mocking GCP DatastoreRepository::performTransaction with MockK

How to test the integration between Google Cloud Storage and Spring Boot using Testcontainers

Circuit Breakers: the What and the Why?