public static void main(String[] args) {
Properties properties = new Properties();
properties.put(PropertyKeyConst.ProducerId, "ProducerId1");
TransactionProducer producer =
ONSFactory.createTransactionProducer(properties, new LocalTransactionCheckerImpl());
producer.start();
Message msg = new Message("TopicTestONS", "TagA", "Hello ONS".getBytes());
SendResult sendResult = producer.send(msg, new LocalTransactionExecuter() {
@Override
public TransactionStatus execute(Message msg, Object arg) {
return TransactionStatus.CommitTransaction;
}
}, null);
System.out.println(sendResult);
producer.shutdown();
}