public static void main(String[] args) {
Properties properties = new Properties();
properties.put(PropertyKeyConst.ConsumerId, "CID_001");
properties.put(PropertyKeyConst.AccessKey, "F0000043D88CB7EF4");
properties.put(PropertyKeyConst.SecretKey, "F0000043D900F191F");
Consumer consumer = ONSFactory.createConsumer(properties);
consumer.subscribe("TopicTestONS", "*", new MessageListener() {
public Action consume(Message message, ConsumeContext context) {
System.out.println("Receive: " + message);
return Action.CommitMessage;
}
});
consumer.start();
System.out.println("Consumer Started");
}