Search in sources :

Example 16 with SendMessageContext

use of org.apache.rocketmq.client.hook.SendMessageContext in project rocketmq by apache.

the class MQClientAPIImplTest method testSendMessageOneWay_Success.

@Test
public void testSendMessageOneWay_Success() throws RemotingException, InterruptedException, MQBrokerException {
    doNothing().when(remotingClient).invokeOneway(anyString(), any(RemotingCommand.class), anyLong());
    SendResult sendResult = mqClientAPI.sendMessage(brokerAddr, brokerName, msg, new SendMessageRequestHeader(), 3 * 1000, CommunicationMode.ONEWAY, new SendMessageContext(), defaultMQProducerImpl);
    assertThat(sendResult).isNull();
}
Also used : RemotingCommand(org.apache.rocketmq.remoting.protocol.RemotingCommand) SendMessageRequestHeader(org.apache.rocketmq.common.protocol.header.SendMessageRequestHeader) SendResult(org.apache.rocketmq.client.producer.SendResult) SendMessageContext(org.apache.rocketmq.client.hook.SendMessageContext) Test(org.junit.Test)

Aggregations

SendMessageContext (org.apache.rocketmq.client.hook.SendMessageContext)16 SendMessageRequestHeader (org.apache.rocketmq.common.protocol.header.SendMessageRequestHeader)14 Test (org.junit.Test)14 RemotingCommand (org.apache.rocketmq.remoting.protocol.RemotingCommand)12 SendResult (org.apache.rocketmq.client.producer.SendResult)8 RemotingException (org.apache.rocketmq.remoting.exception.RemotingException)6 Mockito.doAnswer (org.mockito.Mockito.doAnswer)6 InvocationOnMock (org.mockito.invocation.InvocationOnMock)6 Answer (org.mockito.stubbing.Answer)6 MQBrokerException (org.apache.rocketmq.client.exception.MQBrokerException)4 InvokeCallback (org.apache.rocketmq.remoting.InvokeCallback)4 RemotingTimeoutException (org.apache.rocketmq.remoting.exception.RemotingTimeoutException)4 CountDownLatch (java.util.concurrent.CountDownLatch)2 MQClientException (org.apache.rocketmq.client.exception.MQClientException)2 CheckForbiddenContext (org.apache.rocketmq.client.hook.CheckForbiddenContext)2 SendMessageHook (org.apache.rocketmq.client.hook.SendMessageHook)2 DefaultMQProducerImpl (org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl)2 DefaultMQProducer (org.apache.rocketmq.client.producer.DefaultMQProducer)2 SendCallback (org.apache.rocketmq.client.producer.SendCallback)2 TransactionSendResult (org.apache.rocketmq.client.producer.TransactionSendResult)2