Search in sources :

Example 16 with GetMessageResult

use of org.apache.rocketmq.store.GetMessageResult in project rocketmq by apache.

the class PullMessageProcessorTest method testProcessRequest_MsgWasRemoving.

@Test
public void testProcessRequest_MsgWasRemoving() throws RemotingCommandException {
    GetMessageResult getMessageResult = createGetMessageResult();
    getMessageResult.setStatus(GetMessageStatus.MESSAGE_WAS_REMOVING);
    when(messageStore.getMessage(anyString(), anyString(), anyInt(), anyLong(), anyInt(), any(ExpressionMessageFilter.class))).thenReturn(getMessageResult);
    final RemotingCommand request = createPullMsgCommand(RequestCode.PULL_MESSAGE);
    RemotingCommand response = pullMessageProcessor.processRequest(handlerContext, request);
    assertThat(response).isNotNull();
    assertThat(response.getCode()).isEqualTo(ResponseCode.PULL_RETRY_IMMEDIATELY);
}
Also used : RemotingCommand(org.apache.rocketmq.remoting.protocol.RemotingCommand) GetMessageResult(org.apache.rocketmq.store.GetMessageResult) ExpressionMessageFilter(org.apache.rocketmq.broker.filter.ExpressionMessageFilter) Test(org.junit.Test)

Example 17 with GetMessageResult

use of org.apache.rocketmq.store.GetMessageResult in project rocketmq by apache.

the class PullMessageProcessorTest method createGetMessageResult.

private GetMessageResult createGetMessageResult() {
    GetMessageResult getMessageResult = new GetMessageResult();
    getMessageResult.setStatus(GetMessageStatus.FOUND);
    getMessageResult.setMinOffset(100);
    getMessageResult.setMaxOffset(1024);
    getMessageResult.setNextBeginOffset(516);
    return getMessageResult;
}
Also used : GetMessageResult(org.apache.rocketmq.store.GetMessageResult)

Aggregations

GetMessageResult (org.apache.rocketmq.store.GetMessageResult)17 Test (org.junit.Test)13 ExpressionMessageFilter (org.apache.rocketmq.broker.filter.ExpressionMessageFilter)10 RemotingCommand (org.apache.rocketmq.remoting.protocol.RemotingCommand)10 SubscriptionData (org.apache.rocketmq.common.protocol.heartbeat.SubscriptionData)6 ArrayList (java.util.ArrayList)4 ConsumeMessageContext (org.apache.rocketmq.broker.mqtrace.ConsumeMessageContext)4 MessageExtBrokerInner (org.apache.rocketmq.store.MessageExtBrokerInner)4 UnknownHostException (java.net.UnknownHostException)3 ByteBuffer (java.nio.ByteBuffer)3 MessageFilter (org.apache.rocketmq.store.MessageFilter)3 ChannelFuture (io.netty.channel.ChannelFuture)2 ChannelFutureListener (io.netty.channel.ChannelFutureListener)2 FileRegion (io.netty.channel.FileRegion)2 List (java.util.List)2 ConsumerGroupInfo (org.apache.rocketmq.broker.client.ConsumerGroupInfo)2 ConsumerFilterData (org.apache.rocketmq.broker.filter.ConsumerFilterData)2 ExpressionForRetryMessageFilter (org.apache.rocketmq.broker.filter.ExpressionForRetryMessageFilter)2 PullRequest (org.apache.rocketmq.broker.longpolling.PullRequest)2 ConsumeMessageHook (org.apache.rocketmq.broker.mqtrace.ConsumeMessageHook)2