Skip to content

sunkeycn/spring-boot-starter-ons

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

使用介绍

@SpringBootApplication
@EnableOnsMessage
public class MyApplication {
    public static void main(String[] args){
        SpringApplication.run(MyApplication.class, args);
    }
}

@Component
public class MyMqMessageHandler {
    
    @MessageListener(topic="${ons.order.topic}", tags="*")
    public Action handleMyOrderMessage(String topic, 
                                       String tag, 
                                       String body, 
                                       byte[] data, 
                                       Message message, 
                                       ConsumeContext context){
        // do something...
        return Action.CommitMessage;
    }
    
    @MessageListener(topic="MyTopic", tags="MyTag1||MyTag2||MyTag3")
    public void handleMyOrderMessage(Message message){
        // do something...
    }
    
    @MessageListener(topic="MyTopic")
    public void handleMyOrderMessage(String data) throws Exception {
        // do something...
    }
        
}

About

Aliyun ONS starter for SpringBoot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages