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

The Blind 75 Leetcode Series: Remove Nth Node From End of List

Flutter Navigation Drawer

Systematic Solution for Android Native Memory Leak

Solving Challenging Problems In 3 Easy Steps (As A Consultant)

How to Install OpenLDAP and phpLDAPadmin on Ubuntu 16.04

Lesson 30: The Hash Table Data Structure

How to Set Up Your First CentOS 7 Server on Alibaba Cloud

First World Problem for Developers: Reading Our Own Code

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

HashiCorp Vault | Getting started

macOS: Running IntelliJ IDEA with JDK 17 for Better Render Performance with Metal

EFiVyl

[Spring Boot] Testing Apache Camel SEDA Endpoint

Distributed micro-services using Spring Cloud — Service Discovery — Part 1