org.apache.rocketmq.remoting.netty.ResponseFuture Java Examples
The following examples show how to use
org.apache.rocketmq.remoting.netty.ResponseFuture.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RemotingServerTest.java From DDMQ with Apache License 2.0 | 6 votes |
@Test public void testInvokeAsync() throws InterruptedException, RemotingConnectException, RemotingTimeoutException, RemotingTooMuchRequestException, RemotingSendRequestException { final CountDownLatch latch = new CountDownLatch(1); RemotingCommand request = RemotingCommand.createRequestCommand(0, null); request.setRemark("messi"); remotingClient.invokeAsync("localhost:8888", request, 1000 * 3, new InvokeCallback() { @Override public void operationComplete(ResponseFuture responseFuture) { latch.countDown(); assertTrue(responseFuture != null); assertThat(responseFuture.getResponseCommand().getLanguage()).isEqualTo(LanguageCode.JAVA); assertThat(responseFuture.getResponseCommand().getExtFields()).hasSize(2); } }); latch.await(); }
Example #2
Source File: RemotingServerTest.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 6 votes |
@Test public void testInvokeAsync() throws InterruptedException, RemotingConnectException, RemotingTimeoutException, RemotingTooMuchRequestException, RemotingSendRequestException { final CountDownLatch latch = new CountDownLatch(1); RemotingCommand request = RemotingCommand.createRequestCommand(0, null); request.setRemark("messi"); remotingClient.invokeAsync("localhost:8888", request, 1000 * 3, new InvokeCallback() { @Override public void operationComplete(ResponseFuture responseFuture) { latch.countDown(); assertTrue(responseFuture != null); assertThat(responseFuture.getResponseCommand().getLanguage()).isEqualTo(LanguageCode.JAVA); assertThat(responseFuture.getResponseCommand().getExtFields()).hasSize(2); } }); latch.await(); }
Example #3
Source File: RemotingServerTest.java From rocketmq-4.3.0 with Apache License 2.0 | 6 votes |
@Test public void testInvokeAsync() throws InterruptedException, RemotingConnectException, RemotingTimeoutException, RemotingTooMuchRequestException, RemotingSendRequestException { final CountDownLatch latch = new CountDownLatch(1); RemotingCommand request = RemotingCommand.createRequestCommand(0, null); request.setRemark("messi"); remotingClient.invokeAsync("localhost:8888", request, 1000 * 3, new InvokeCallback() { @Override public void operationComplete(ResponseFuture responseFuture) { latch.countDown(); assertTrue(responseFuture != null); assertThat(responseFuture.getResponseCommand().getLanguage()).isEqualTo(LanguageCode.JAVA); assertThat(responseFuture.getResponseCommand().getExtFields()).hasSize(2); } }); latch.await(); }
Example #4
Source File: RemotingServerTest.java From DDMQ with Apache License 2.0 | 6 votes |
@Test public void testInvokeAsync() throws InterruptedException, RemotingConnectException, RemotingTimeoutException, RemotingTooMuchRequestException, RemotingSendRequestException { final CountDownLatch latch = new CountDownLatch(1); RemotingCommand request = RemotingCommand.createRequestCommand(0, null); request.setRemark("messi"); remotingClient.invokeAsync("localhost:8888", request, 1000 * 3, new InvokeCallback() { @Override public void operationComplete(ResponseFuture responseFuture) { latch.countDown(); assertTrue(responseFuture != null); assertThat(responseFuture.getResponseCommand().getLanguage()).isEqualTo(LanguageCode.JAVA); assertThat(responseFuture.getResponseCommand().getExtFields()).hasSize(2); } }); latch.await(); }
Example #5
Source File: RemotingServerTest.java From rocketmq with Apache License 2.0 | 6 votes |
@Test public void testInvokeAsync() throws InterruptedException, RemotingConnectException, RemotingTimeoutException, RemotingTooMuchRequestException, RemotingSendRequestException { final CountDownLatch latch = new CountDownLatch(1); RemotingCommand request = RemotingCommand.createRequestCommand(0, null); request.setRemark("messi"); remotingClient.invokeAsync("localhost:8888", request, 1000 * 3, new InvokeCallback() { @Override public void operationComplete(ResponseFuture responseFuture) { latch.countDown(); assertTrue(responseFuture != null); assertThat(responseFuture.getResponseCommand().getLanguage()).isEqualTo(LanguageCode.JAVA); assertThat(responseFuture.getResponseCommand().getExtFields()).hasSize(2); } }); latch.await(); }
Example #6
Source File: RemotingServerTest.java From rocketmq-read with Apache License 2.0 | 6 votes |
@Test public void testInvokeAsync() throws InterruptedException, RemotingConnectException, RemotingTimeoutException, RemotingTooMuchRequestException, RemotingSendRequestException { final CountDownLatch latch = new CountDownLatch(1); RemotingCommand request = RemotingCommand.createRequestCommand(0, null); request.setRemark("messi"); remotingClient.invokeAsync("localhost:8888", request, 1000 * 3, new InvokeCallback() { @Override public void operationComplete(ResponseFuture responseFuture) { latch.countDown(); assertTrue(responseFuture != null); assertThat(responseFuture.getResponseCommand().getLanguage()).isEqualTo(LanguageCode.JAVA); assertThat(responseFuture.getResponseCommand().getExtFields()).hasSize(2); } }); latch.await(); }
Example #7
Source File: MQClientAPIImplTest.java From rocketmq with Apache License 2.0 | 5 votes |
@Test public void testSendMessageTypeofReply() throws Exception { doAnswer(new Answer() { @Override public Object answer(InvocationOnMock mock) throws Throwable { InvokeCallback callback = mock.getArgument(3); RemotingCommand request = mock.getArgument(1); ResponseFuture responseFuture = new ResponseFuture(null, request.getOpaque(), 3 * 1000, null, null); responseFuture.setResponseCommand(createSuccessResponse(request)); callback.operationComplete(responseFuture); return null; } }).when(remotingClient).invokeAsync(Matchers.anyString(), Matchers.any(RemotingCommand.class), Matchers.anyLong(), Matchers.any(InvokeCallback.class)); SendMessageContext sendMessageContext = new SendMessageContext(); sendMessageContext.setProducer(new DefaultMQProducerImpl(new DefaultMQProducer())); msg.getProperties().put("MSG_TYPE", "reply"); mqClientAPI.sendMessage(brokerAddr, brokerName, msg, new SendMessageRequestHeader(), 3 * 1000, CommunicationMode.ASYNC, new SendCallback() { @Override public void onSuccess(SendResult sendResult) { assertThat(sendResult.getSendStatus()).isEqualTo(SendStatus.SEND_OK); assertThat(sendResult.getOffsetMsgId()).isEqualTo("123"); assertThat(sendResult.getQueueOffset()).isEqualTo(123L); assertThat(sendResult.getMessageQueue().getQueueId()).isEqualTo(1); } @Override public void onException(Throwable e) { } }, null, null, 0, sendMessageContext, defaultMQProducerImpl); }
Example #8
Source File: DeFiBusClientAPIImplTest.java From DeFiBus with Apache License 2.0 | 5 votes |
@Test public void testSendMessagetypeOfnull_Success() throws RemotingException, InterruptedException, MQBrokerException { doAnswer(new Answer() { @Override public Object answer(InvocationOnMock mock) throws Throwable { InvokeCallback callback = mock.getArgument(3); RemotingCommand request = mock.getArgument(1); ResponseFuture responseFuture = new ResponseFuture(null, request.getOpaque(), 3 * 1000, null, null); responseFuture.setResponseCommand(createSuccessResponse(request)); callback.operationComplete(responseFuture); return null; } }).when(remotingClient).invokeAsync(anyString(), any(RemotingCommand.class), anyLong(), any(InvokeCallback.class)); SendMessageContext sendMessageContext = new SendMessageContext(); sendMessageContext.setProducer(new DefaultMQProducerImpl(new DefaultMQProducer())); deFiBusClientAPI.sendMessage(brokerAddr, brokerName, msg, new SendMessageRequestHeader(), 3 * 1000, CommunicationMode.ASYNC, new SendCallback() { @Override public void onSuccess(SendResult sendResult) { assertThat(sendResult.getSendStatus()).isEqualTo(SendStatus.SEND_OK); assertThat(sendResult.getOffsetMsgId()).isEqualTo("123"); assertThat(sendResult.getQueueOffset()).isEqualTo(123L); assertThat(sendResult.getMessageQueue().getQueueId()).isEqualTo(1); } @Override public void onException(Throwable e) { } }, null, null, 0, sendMessageContext, defaultMQProducerImpl); }
Example #9
Source File: DeFiBusClientAPIImplTest.java From DeFiBus with Apache License 2.0 | 5 votes |
@Test public void testSendMessageTypeOfReply_Success() throws Exception { doAnswer(new Answer() { @Override public Object answer(InvocationOnMock mock) throws Throwable { InvokeCallback callback = mock.getArgument(3); RemotingCommand request = mock.getArgument(1); ResponseFuture responseFuture = new ResponseFuture(null, request.getOpaque(), 3 * 1000, null, null); responseFuture.setResponseCommand(createSuccessResponse(request)); callback.operationComplete(responseFuture); return null; } }).when(remotingClient).invokeAsync(anyString(), any(RemotingCommand.class), anyLong(), any(InvokeCallback.class)); SendMessageContext sendMessageContext = new SendMessageContext(); sendMessageContext.setProducer(new DefaultMQProducerImpl(new DefaultMQProducer())); msg.getProperties().put("msgType", "reply"); deFiBusClientAPI.sendMessage(brokerAddr, brokerName, msg, new SendMessageRequestHeader(), 3 * 1000, CommunicationMode.ASYNC, new SendCallback() { @Override public void onSuccess(SendResult sendResult) { assertThat(sendResult.getSendStatus()).isEqualTo(SendStatus.SEND_OK); assertThat(sendResult.getOffsetMsgId()).isEqualTo("123"); assertThat(sendResult.getQueueOffset()).isEqualTo(123L); assertThat(sendResult.getMessageQueue().getQueueId()).isEqualTo(1); } @Override public void onException(Throwable e) { } }, null, null, 0, sendMessageContext, defaultMQProducerImpl); }
Example #10
Source File: InvokeCallback.java From rocketmq-read with Apache License 2.0 | 2 votes |
/** * 当执行成功以后的回调接口 * @param responseFuture responseFulture */ void operationComplete(final ResponseFuture responseFuture);
Example #11
Source File: InvokeCallback.java From rocketmq with Apache License 2.0 | votes |
void operationComplete(final ResponseFuture responseFuture);
Example #12
Source File: InvokeCallback.java From DDMQ with Apache License 2.0 | votes |
void operationComplete(final ResponseFuture responseFuture);
Example #13
Source File: InvokeCallback.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | votes |
void operationComplete(final ResponseFuture responseFuture);
Example #14
Source File: InvokeCallback.java From rocketmq-4.3.0 with Apache License 2.0 | votes |
void operationComplete(final ResponseFuture responseFuture);
Example #15
Source File: InvokeCallback.java From rocketmq_trans_message with Apache License 2.0 | votes |
void operationComplete(final ResponseFuture responseFuture);
Example #16
Source File: InvokeCallback.java From rocketmq with Apache License 2.0 | votes |
void operationComplete(final ResponseFuture responseFuture);
Example #17
Source File: InvokeCallback.java From DDMQ with Apache License 2.0 | votes |
void operationComplete(final ResponseFuture responseFuture);