Skip to content

loopkeybr/tuya-pulsar-sdk-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pulsar-client-java

English | 中文版

Overview

The current SDK is to facilitate developers to connect to Tuya’s message center and access pulsar. For more information, see Tuya Message Queue.

Preparation before use

  • AccessID: Obtained from Tuya platform
  • AccessKey: Obtained from Tuya platform
  • Pulsar address: Choose Pulsar address according to different business areas. For more information about acquiring the address, see Tuya Message Queue.

Example

 public static void main(String[] args) throws Exception {
        String url = MqConfigs.CN_SERVER_URL;
        String accessId = "";
        String accessKey = "";

        MqConsumer mqConsumer = MqConsumer.build().serviceUrl(url).accessId(accessId).accessKey(accessKey)
                .maxRedeliverCount(3).messageListener(message -> {
                            System.out.println("------------------------------------------- --------");
                            System.out.println("Message received:" + new String(message.getData()) + ",seq="
                                    + message.getSequenceId() + ",time=" + message.getPublishTime() + ",consumed time="
                                    + System.currentTimeMillis());
                            String jsonMessage = new String(message.getData());
                            MessageVO vo = JSON.parseObject(jsonMessage, MessageVO.class);
                            System.out.println("the real message data:" + AESBase64Utils.decrypt(vo.getData(), accessKey.substring(8, 24)));
                        }

                );
        mqConsumer.start();
    }

Precautions

N/A.

Technical Support

You can get Tua developer technical support in the following ways:

About

Tuya Pulsar SDK for java

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%