Search in sources :

Example 26 with PutMessageResult

use of org.apache.rocketmq.store.PutMessageResult in project rocketmq-rocketmq-all-4.1.0-incubating by lirenzuo.

the class SendMessageProcessorTest method testProcessRequest_PropertiesTooLong.

@Test
public void testProcessRequest_PropertiesTooLong() throws RemotingCommandException {
    when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult(PutMessageStatus.PROPERTIES_SIZE_EXCEEDED, new AppendMessageResult(AppendMessageStatus.UNKNOWN_ERROR)));
    assertPutResult(ResponseCode.MESSAGE_ILLEGAL);
}
Also used : PutMessageResult(org.apache.rocketmq.store.PutMessageResult) MessageExtBrokerInner(org.apache.rocketmq.store.MessageExtBrokerInner) AppendMessageResult(org.apache.rocketmq.store.AppendMessageResult) Test(org.junit.Test)

Example 27 with PutMessageResult

use of org.apache.rocketmq.store.PutMessageResult in project rocketmq-rocketmq-all-4.1.0-incubating by lirenzuo.

the class SendMessageProcessorTest method testProcessRequest_ServiceNotAvailable.

@Test
public void testProcessRequest_ServiceNotAvailable() throws RemotingCommandException {
    when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult(PutMessageStatus.SERVICE_NOT_AVAILABLE, new AppendMessageResult(AppendMessageStatus.UNKNOWN_ERROR)));
    assertPutResult(ResponseCode.SERVICE_NOT_AVAILABLE);
}
Also used : PutMessageResult(org.apache.rocketmq.store.PutMessageResult) MessageExtBrokerInner(org.apache.rocketmq.store.MessageExtBrokerInner) AppendMessageResult(org.apache.rocketmq.store.AppendMessageResult) Test(org.junit.Test)

Example 28 with PutMessageResult

use of org.apache.rocketmq.store.PutMessageResult in project rocketmq-rocketmq-all-4.1.0-incubating by lirenzuo.

the class SendMessageProcessorTest method testProcessRequest_CreateMappedFileFailed.

@Test
public void testProcessRequest_CreateMappedFileFailed() throws RemotingCommandException {
    when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult(PutMessageStatus.CREATE_MAPEDFILE_FAILED, new AppendMessageResult(AppendMessageStatus.UNKNOWN_ERROR)));
    assertPutResult(ResponseCode.SYSTEM_ERROR);
}
Also used : PutMessageResult(org.apache.rocketmq.store.PutMessageResult) MessageExtBrokerInner(org.apache.rocketmq.store.MessageExtBrokerInner) AppendMessageResult(org.apache.rocketmq.store.AppendMessageResult) Test(org.junit.Test)

Example 29 with PutMessageResult

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

the class MessageStoreWithFilterTest method putMsg.

protected List<MessageExtBrokerInner> putMsg(DefaultMessageStore master, int topicCount, int msgCountPerTopic) throws Exception {
    List<MessageExtBrokerInner> msgs = new ArrayList<MessageExtBrokerInner>();
    for (int i = 0; i < topicCount; i++) {
        String realTopic = topic + i;
        for (int j = 0; j < msgCountPerTopic; j++) {
            MessageExtBrokerInner msg = buildMessage();
            msg.setTopic(realTopic);
            msg.putUserProperty("a", String.valueOf(j * 10 + 5));
            msg.setPropertiesString(MessageDecoder.messageProperties2String(msg.getProperties()));
            PutMessageResult result = master.putMessage(msg);
            msg.setMsgId(result.getAppendMessageResult().getMsgId());
            msgs.add(msg);
        }
    }
    return msgs;
}
Also used : PutMessageResult(org.apache.rocketmq.store.PutMessageResult) ArrayList(java.util.ArrayList) MessageExtBrokerInner(org.apache.rocketmq.store.MessageExtBrokerInner)

Example 30 with PutMessageResult

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

the class SendMessageProcessorTest method testProcessRequest_SlaveNotAvailable.

@Test
public void testProcessRequest_SlaveNotAvailable() throws RemotingCommandException {
    when(messageStore.putMessage(any(MessageExtBrokerInner.class))).thenReturn(new PutMessageResult(PutMessageStatus.SLAVE_NOT_AVAILABLE, new AppendMessageResult(AppendMessageStatus.UNKNOWN_ERROR)));
    assertPutResult(ResponseCode.SLAVE_NOT_AVAILABLE);
}
Also used : PutMessageResult(org.apache.rocketmq.store.PutMessageResult) MessageExtBrokerInner(org.apache.rocketmq.store.MessageExtBrokerInner) AppendMessageResult(org.apache.rocketmq.store.AppendMessageResult) Test(org.junit.Test)

Aggregations

PutMessageResult (org.apache.rocketmq.store.PutMessageResult)34 MessageExtBrokerInner (org.apache.rocketmq.store.MessageExtBrokerInner)32 AppendMessageResult (org.apache.rocketmq.store.AppendMessageResult)22 Test (org.junit.Test)22 RemotingCommand (org.apache.rocketmq.remoting.protocol.RemotingCommand)10 TopicConfig (org.apache.rocketmq.common.TopicConfig)6 ArrayList (java.util.ArrayList)4 MessageExt (org.apache.rocketmq.common.message.MessageExt)4 SendMessageResponseHeader (org.apache.rocketmq.common.protocol.header.SendMessageResponseHeader)4 ConsumeMessageContext (org.apache.rocketmq.broker.mqtrace.ConsumeMessageContext)2 SendMessageContext (org.apache.rocketmq.broker.mqtrace.SendMessageContext)2 SendMessageHook (org.apache.rocketmq.broker.mqtrace.SendMessageHook)2 MessageExtBatch (org.apache.rocketmq.common.message.MessageExtBatch)2 ConsumerSendMsgBackRequestHeader (org.apache.rocketmq.common.protocol.header.ConsumerSendMsgBackRequestHeader)2 EndTransactionRequestHeader (org.apache.rocketmq.common.protocol.header.EndTransactionRequestHeader)2 SubscriptionGroupConfig (org.apache.rocketmq.common.subscription.SubscriptionGroupConfig)2 RemotingCommandException (org.apache.rocketmq.remoting.exception.RemotingCommandException)2 MessageStore (org.apache.rocketmq.store.MessageStore)2