Java源码示例:org.apache.rocketmq.broker.transaction.TransactionalMessageService

示例1
private void initialTransaction() {
//        加载分布式消息事务服务
        this.transactionalMessageService = ServiceProvider.loadClass(ServiceProvider.TRANSACTION_SERVICE_ID, TransactionalMessageService.class);
        if (null == this.transactionalMessageService) {
            this.transactionalMessageService = new TransactionalMessageServiceImpl(new TransactionalMessageBridge(this, this.getMessageStore()));
            log.warn("Load default transaction message hook service: {}", TransactionalMessageServiceImpl.class.getSimpleName());
        }
//        加载分布式消息事务检查监听器
        this.transactionalMessageCheckListener = ServiceProvider.loadClass(ServiceProvider.TRANSACTION_LISTENER_ID, AbstractTransactionalMessageCheckListener.class);
        if (null == this.transactionalMessageCheckListener) {
            this.transactionalMessageCheckListener = new DefaultTransactionalMessageCheckListener();
            log.warn("Load default discard message hook service: {}", DefaultTransactionalMessageCheckListener.class.getSimpleName());
        }
        this.transactionalMessageCheckListener.setBrokerController(this);
        this.transactionalMessageCheckService = new TransactionalMessageCheckService(this);
    }
 
示例2
/**
 * 初始化事务
 */
private void initialTransaction() {
    /*
     * 先通过SPI获取,没有就是使用default的来实现
     */
    this.transactionalMessageService = ServiceProvider.loadClass(ServiceProvider.TRANSACTION_SERVICE_ID, TransactionalMessageService.class);
    if (null == this.transactionalMessageService) {
        this.transactionalMessageService = new TransactionalMessageServiceImpl(new TransactionalMessageBridge(this, this.getMessageStore()));
        log.warn("Load default transaction message hook service: {}", TransactionalMessageServiceImpl.class.getSimpleName());
    }
    this.transactionalMessageCheckListener = ServiceProvider.loadClass(ServiceProvider.TRANSACTION_LISTENER_ID, AbstractTransactionalMessageCheckListener.class);
    if (null == this.transactionalMessageCheckListener) {
        this.transactionalMessageCheckListener = new DefaultTransactionalMessageCheckListener();
        log.warn("Load default discard message hook service: {}", DefaultTransactionalMessageCheckListener.class.getSimpleName());
    }
    this.transactionalMessageCheckListener.setBrokerController(this);
    this.transactionalMessageCheckService = new TransactionalMessageCheckService(this);
}
 
示例3
private void initialTransaction() {
    this.transactionalMessageService = ServiceProvider.loadClass(ServiceProvider.TRANSACTION_SERVICE_ID, TransactionalMessageService.class);
    if (null == this.transactionalMessageService) {
        this.transactionalMessageService = new TransactionalMessageServiceImpl(new TransactionalMessageBridge(this, this.getMessageStore()));
        log.warn("Load default transaction message hook service: {}", TransactionalMessageServiceImpl.class.getSimpleName());
    }
    this.transactionalMessageCheckListener = ServiceProvider.loadClass(ServiceProvider.TRANSACTION_LISTENER_ID, AbstractTransactionalMessageCheckListener.class);
    if (null == this.transactionalMessageCheckListener) {
        this.transactionalMessageCheckListener = new DefaultTransactionalMessageCheckListener();
        log.warn("Load default discard message hook service: {}", DefaultTransactionalMessageCheckListener.class.getSimpleName());
    }
    this.transactionalMessageCheckListener.setBrokerController(this);
    this.transactionalMessageCheckService = new TransactionalMessageCheckService(this);
}
 
示例4
public TransactionalMessageService getTransactionalMessageService() {
    return transactionalMessageService;
}
 
示例5
public void setTransactionalMessageService(TransactionalMessageService transactionalMessageService) {
    this.transactionalMessageService = transactionalMessageService;
}
 
示例6
@Test
public void loadTransactionMsgServiceTest() {
    TransactionalMessageService transactionService = ServiceProvider.loadClass(ServiceProvider.TRANSACTION_SERVICE_ID,
        TransactionalMessageService.class);
    assertThat(transactionService).isNotNull();
}
 
示例7
public TransactionalMessageService getTransactionalMessageService() {
    return transactionalMessageService;
}
 
示例8
public void setTransactionalMessageService(TransactionalMessageService transactionalMessageService) {
    this.transactionalMessageService = transactionalMessageService;
}
 
示例9
@Test
public void loadTransactionMsgServiceTest() {
    TransactionalMessageService transactionService = ServiceProvider.loadClass(ServiceProvider.TRANSACTION_SERVICE_ID,
        TransactionalMessageService.class);
    assertThat(transactionService).isNotNull();
}
 
示例10
public TransactionalMessageService getTransactionalMessageService() {
    return transactionalMessageService;
}
 
示例11
public void setTransactionalMessageService(TransactionalMessageService transactionalMessageService) {
    this.transactionalMessageService = transactionalMessageService;
}
 
示例12
@Test
public void loadTransactionMsgServiceTest() {
    TransactionalMessageService transactionService = ServiceProvider.loadClass(ServiceProvider.TRANSACTION_SERVICE_ID,
        TransactionalMessageService.class);
    assertThat(transactionService).isNotNull();
}