Search in sources :

Example 1 with MessageTrack

use of org.apache.rocketmq.tools.admin.api.MessageTrack in project rocketmq-externals by apache.

the class MessageServiceImpl method viewMessage.

public Pair<MessageView, List<MessageTrack>> viewMessage(String subject, final String msgId) {
    try {
        MessageExt messageExt = mqAdminExt.viewMessage(subject, msgId);
        List<MessageTrack> messageTrackList = messageTrackDetail(messageExt);
        return new Pair<>(MessageView.fromMessageExt(messageExt), messageTrackList);
    } catch (Exception e) {
        throw Throwables.propagate(e);
    }
}
Also used : MessageExt(org.apache.rocketmq.common.message.MessageExt) MessageTrack(org.apache.rocketmq.tools.admin.api.MessageTrack) Pair(org.apache.rocketmq.common.Pair)

Example 2 with MessageTrack

use of org.apache.rocketmq.tools.admin.api.MessageTrack in project rocketmq-externals by apache.

the class MessageServiceImplTest method viewMessage.

@Test
public void viewMessage() throws Exception {
    final String messageId = msgId;
    Pair<MessageView, List<MessageTrack>> messageViewListPair = new RetryTempLate<Pair<MessageView, List<MessageTrack>>>() {

        @Override
        protected Pair<MessageView, List<MessageTrack>> process() throws Exception {
            return messageService.viewMessage(TEST_CONSOLE_TOPIC, messageId);
        }
    }.execute(10, 1000);
    MessageView messageView = messageViewListPair.getObject1();
    Assert.assertEquals(messageView.getMessageBody(), TEST_TOPIC_MESSAGE_BODY);
}
Also used : MessageView(org.apache.rocketmq.console.model.MessageView) MessageTrack(org.apache.rocketmq.tools.admin.api.MessageTrack) List(java.util.List) Pair(org.apache.rocketmq.common.Pair) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 3 with MessageTrack

use of org.apache.rocketmq.tools.admin.api.MessageTrack in project rocketmq-externals by apache.

the class MessageServiceImplTest method messageTrackDetail.

@Test
public void messageTrackDetail() throws Exception {
    final String messageId = msgId;
    Pair<MessageView, List<MessageTrack>> messageViewListPair = new RetryTempLate<Pair<MessageView, List<MessageTrack>>>() {

        @Override
        protected Pair<MessageView, List<MessageTrack>> process() throws Exception {
            return messageService.viewMessage(TEST_CONSOLE_TOPIC, messageId);
        }
    }.execute(10, // make the topic can be found
    1000);
    final MessageExt messageExt = mqAdminExt.viewMessage(TEST_CONSOLE_TOPIC, messageId);
    Assert.assertNotNull(messageService.messageTrackDetail(messageExt));
}
Also used : MessageExt(org.apache.rocketmq.common.message.MessageExt) MessageView(org.apache.rocketmq.console.model.MessageView) MessageTrack(org.apache.rocketmq.tools.admin.api.MessageTrack) List(java.util.List) Pair(org.apache.rocketmq.common.Pair) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

Pair (org.apache.rocketmq.common.Pair)3 MessageTrack (org.apache.rocketmq.tools.admin.api.MessageTrack)3 List (java.util.List)2 MessageExt (org.apache.rocketmq.common.message.MessageExt)2 MessageView (org.apache.rocketmq.console.model.MessageView)2 Test (org.junit.Test)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2