org.apache.rocketmq.test.factory.MessageFactory Java Examples

The following examples show how to use org.apache.rocketmq.test.factory.MessageFactory. 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: MessageUserPropIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test
public void testSendEnglishUserProp() {
    Message msg = MessageFactory.getRandomMessage(topic);
    String msgKey = "jueyinKey";
    String msgValue = "jueyinValue";
    msg.putUserProperty(msgKey, msgValue);

    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQNormalListener());

    producer.send(msg, null);
    assertThat(producer.getAllMsgBody().size()).isEqualTo(1);

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    Message sendMsg = (Message) producer.getFirstMsg();
    Message recvMsg = (Message) consumer.getListener().getFirstMsg();
    assertThat(recvMsg.getUserProperty(msgKey)).isEqualTo(sendMsg.getUserProperty(msgKey));
}
 
Example #2
Source File: MessageUserPropIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test
public void testSendChinaUserProp() {
    Message msg = MessageFactory.getRandomMessage(topic);
    String msgKey = "jueyinKey";
    String msgValue = "jueyinzhi";
    msg.putUserProperty(msgKey, msgValue);

    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQNormalListner());

    producer.send(msg, null);
    assertThat(producer.getAllMsgBody().size()).isEqualTo(1);

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    Message sendMsg = (Message) producer.getFirstMsg();
    Message recvMsg = (Message) consumer.getListner().getFirstMsg();
    assertThat(recvMsg.getUserProperty(msgKey)).isEqualTo(sendMsg.getUserProperty(msgKey));
}
 
Example #3
Source File: MessageUserPropIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test
public void testSendEnglishUserProp() {
    Message msg = MessageFactory.getRandomMessage(topic);
    String msgKey = "jueyinKey";
    String msgValue = "jueyinValue";
    msg.putUserProperty(msgKey, msgValue);

    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQNormalListner());

    producer.send(msg, null);
    assertThat(producer.getAllMsgBody().size()).isEqualTo(1);

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    Message sendMsg = (Message) producer.getFirstMsg();
    Message recvMsg = (Message) consumer.getListner().getFirstMsg();
    assertThat(recvMsg.getUserProperty(msgKey)).isEqualTo(sendMsg.getUserProperty(msgKey));
}
 
Example #4
Source File: MessageUserPropIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test
public void testSendChinaUserProp() {
    Message msg = MessageFactory.getRandomMessage(topic);
    String msgKey = "jueyinKey";
    String msgValue = "jueyinzhi";
    msg.putUserProperty(msgKey, msgValue);

    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQNormalListner());

    producer.send(msg, null);
    assertThat(producer.getAllMsgBody().size()).isEqualTo(1);

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    Message sendMsg = (Message) producer.getFirstMsg();
    Message recvMsg = (Message) consumer.getListner().getFirstMsg();
    assertThat(recvMsg.getUserProperty(msgKey)).isEqualTo(sendMsg.getUserProperty(msgKey));
}
 
Example #5
Source File: MessageUserPropIT.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test
public void testSendEnglishUserProp() {
    Message msg = MessageFactory.getRandomMessage(topic);
    String msgKey = "jueyinKey";
    String msgValue = "jueyinValue";
    msg.putUserProperty(msgKey, msgValue);

    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQNormalListner());

    producer.send(msg, null);
    assertThat(producer.getAllMsgBody().size()).isEqualTo(1);

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    Message sendMsg = (Message) producer.getFirstMsg();
    Message recvMsg = (Message) consumer.getListner().getFirstMsg();
    assertThat(recvMsg.getUserProperty(msgKey)).isEqualTo(sendMsg.getUserProperty(msgKey));
}
 
Example #6
Source File: MessageUserPropIT.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test
public void testSendChinaUserProp() {
    Message msg = MessageFactory.getRandomMessage(topic);
    String msgKey = "jueyinKey";
    String msgValue = "jueyinzhi";
    msg.putUserProperty(msgKey, msgValue);

    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQNormalListener());

    producer.send(msg, null);
    assertThat(producer.getAllMsgBody().size()).isEqualTo(1);

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    Message sendMsg = (Message) producer.getFirstMsg();
    Message recvMsg = (Message) consumer.getListener().getFirstMsg();
    assertThat(recvMsg.getUserProperty(msgKey)).isEqualTo(sendMsg.getUserProperty(msgKey));
}
 
Example #7
Source File: MessageUserPropIT.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test
public void testSendEnglishUserProp() {
    Message msg = MessageFactory.getRandomMessage(topic);
    String msgKey = "jueyinKey";
    String msgValue = "jueyinValue";
    msg.putUserProperty(msgKey, msgValue);

    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQNormalListener());

    producer.send(msg, null);
    assertThat(producer.getAllMsgBody().size()).isEqualTo(1);

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    Message sendMsg = (Message) producer.getFirstMsg();
    Message recvMsg = (Message) consumer.getListener().getFirstMsg();
    assertThat(recvMsg.getUserProperty(msgKey)).isEqualTo(sendMsg.getUserProperty(msgKey));
}
 
Example #8
Source File: MessageUserPropIT.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test
public void testSendChinaUserProp() {
    Message msg = MessageFactory.getRandomMessage(topic);
    String msgKey = "jueyinKey";
    String msgValue = "jueyinzhi";
    msg.putUserProperty(msgKey, msgValue);

    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQNormalListner());

    producer.send(msg, null);
    assertThat(producer.getAllMsgBody().size()).isEqualTo(1);

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    Message sendMsg = (Message) producer.getFirstMsg();
    Message recvMsg = (Message) consumer.getListner().getFirstMsg();
    assertThat(recvMsg.getUserProperty(msgKey)).isEqualTo(sendMsg.getUserProperty(msgKey));
}
 
Example #9
Source File: MessageUserPropIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test
public void testSendEnglishUserProp() {
    Message msg = MessageFactory.getRandomMessage(topic);
    String msgKey = "jueyinKey";
    String msgValue = "jueyinValue";
    msg.putUserProperty(msgKey, msgValue);

    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQNormalListner());

    producer.send(msg, null);
    assertThat(producer.getAllMsgBody().size()).isEqualTo(1);

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    Message sendMsg = (Message) producer.getFirstMsg();
    Message recvMsg = (Message) consumer.getListner().getFirstMsg();
    assertThat(recvMsg.getUserProperty(msgKey)).isEqualTo(sendMsg.getUserProperty(msgKey));
}
 
Example #10
Source File: MessageUserPropIT.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test
public void testSendChinaUserProp() {
    Message msg = MessageFactory.getRandomMessage(topic);
    String msgKey = "jueyinKey";
    String msgValue = "jueyinzhi";
    msg.putUserProperty(msgKey, msgValue);

    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQNormalListener());

    producer.send(msg, null);
    assertThat(producer.getAllMsgBody().size()).isEqualTo(1);

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    Message sendMsg = (Message) producer.getFirstMsg();
    Message recvMsg = (Message) consumer.getListener().getFirstMsg();
    assertThat(recvMsg.getUserProperty(msgKey)).isEqualTo(sendMsg.getUserProperty(msgKey));
}
 
Example #11
Source File: MessageUserPropIT.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test
public void testSendEnglishUserProp() {
    Message msg = MessageFactory.getRandomMessage(topic);
    String msgKey = "jueyinKey";
    String msgValue = "jueyinValue";
    msg.putUserProperty(msgKey, msgValue);

    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQNormalListener());

    producer.send(msg, null);
    assertThat(producer.getAllMsgBody().size()).isEqualTo(1);

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    Message sendMsg = (Message) producer.getFirstMsg();
    Message recvMsg = (Message) consumer.getListener().getFirstMsg();
    assertThat(recvMsg.getUserProperty(msgKey)).isEqualTo(sendMsg.getUserProperty(msgKey));
}
 
Example #12
Source File: MessageUserPropIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test
public void testSendChinaUserProp() {
    Message msg = MessageFactory.getRandomMessage(topic);
    String msgKey = "jueyinKey";
    String msgValue = "jueyinzhi";
    msg.putUserProperty(msgKey, msgValue);

    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQNormalListener());

    producer.send(msg, null);
    assertThat(producer.getAllMsgBody().size()).isEqualTo(1);

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    Message sendMsg = (Message) producer.getFirstMsg();
    Message recvMsg = (Message) consumer.getListener().getFirstMsg();
    assertThat(recvMsg.getUserProperty(msgKey)).isEqualTo(sendMsg.getUserProperty(msgKey));
}
 
Example #13
Source File: MessageUserPropIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test
public void testSendEnglishUserProp() {
    Message msg = MessageFactory.getRandomMessage(topic);
    String msgKey = "jueyinKey";
    String msgValue = "jueyinValue";
    msg.putUserProperty(msgKey, msgValue);

    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQNormalListener());

    producer.send(msg, null);
    assertThat(producer.getAllMsgBody().size()).isEqualTo(1);

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    Message sendMsg = (Message) producer.getFirstMsg();
    Message recvMsg = (Message) consumer.getListener().getFirstMsg();
    assertThat(recvMsg.getUserProperty(msgKey)).isEqualTo(sendMsg.getUserProperty(msgKey));
}
 
Example #14
Source File: MessageUserPropIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test
public void testSendChinaUserProp() {
    Message msg = MessageFactory.getRandomMessage(topic);
    String msgKey = "jueyinKey";
    String msgValue = "jueyinzhi";
    msg.putUserProperty(msgKey, msgValue);

    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQNormalListener());

    producer.send(msg, null);
    assertThat(producer.getAllMsgBody().size()).isEqualTo(1);

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    Message sendMsg = (Message) producer.getFirstMsg();
    Message recvMsg = (Message) consumer.getListener().getFirstMsg();
    assertThat(recvMsg.getUserProperty(msgKey)).isEqualTo(sendMsg.getUserProperty(msgKey));
}
 
Example #15
Source File: MessageUserPropIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test
public void testSendChinaUserProp() {
    Message msg = MessageFactory.getRandomMessage(topic);
    String msgKey = "jueyinKey";
    String msgValue = "jueyinzhi";
    msg.putUserProperty(msgKey, msgValue);

    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQNormalListener());

    producer.send(msg, null);
    assertThat(producer.getAllMsgBody().size()).isEqualTo(1);

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    Message sendMsg = (Message) producer.getFirstMsg();
    Message recvMsg = (Message) consumer.getListener().getFirstMsg();
    assertThat(recvMsg.getUserProperty(msgKey)).isEqualTo(sendMsg.getUserProperty(msgKey));
}
 
Example #16
Source File: MessageUserPropIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test
public void testSendEnglishUserProp() {
    Message msg = MessageFactory.getRandomMessage(topic);
    String msgKey = "jueyinKey";
    String msgValue = "jueyinValue";
    msg.putUserProperty(msgKey, msgValue);

    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQNormalListener());

    producer.send(msg, null);
    assertThat(producer.getAllMsgBody().size()).isEqualTo(1);

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    Message sendMsg = (Message) producer.getFirstMsg();
    Message recvMsg = (Message) consumer.getListener().getFirstMsg();
    assertThat(recvMsg.getUserProperty(msgKey)).isEqualTo(sendMsg.getUserProperty(msgKey));
}
 
Example #17
Source File: ChinaPropIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test
public void testSend10kChinaPropMsg() {

    Message msg = MessageFactory.getRandomMessage(topic);
    msg.putUserProperty("key", RandomUtils.getCheseWord(10 * 1024));
    SendResult sendResult = null;
    try {
        sendResult = producer.send(msg);
    } catch (Exception e) {
    }
    assertThat(sendResult.getSendStatus()).isEqualTo(SendStatus.SEND_OK);
}
 
Example #18
Source File: MessageExceptionIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
@Test
public void testSendMsgWithUserProperty() {
    Message msg = MessageFactory.getRandomMessage(topic);
    msg.putUserProperty("key", RandomUtils.getCheseWord(10 * 1024));
    SendResult sendResult = null;
    try {
        sendResult = producer.send(msg);
    } catch (Exception e) {
    }
    assertThat(sendResult.getSendStatus()).isEqualTo(SendStatus.SEND_OK);
}
 
Example #19
Source File: ChinaPropIT.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test(expected = org.apache.rocketmq.client.exception.MQBrokerException.class)
public void testSend20kChinaPropMsg() throws Exception {
    Message msg = MessageFactory.getRandomMessage(topic);
    msg.putUserProperty("key", RandomUtils.getCheseWord(32 * 1024 + 1));
    producer.send(msg);
}
 
Example #20
Source File: ChinaPropIT.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test(expected = org.apache.rocketmq.client.exception.MQBrokerException.class)
public void testSend20kChinaPropMsg() throws Exception {
    Message msg = MessageFactory.getRandomMessage(topic);
    msg.putUserProperty("key", RandomUtils.getCheseWord(32 * 1024 + 1));
    producer.send(msg);
}
 
Example #21
Source File: ChinaPropIT.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test
public void testSend10kChinaPropMsg() {

    Message msg = MessageFactory.getRandomMessage(topic);
    msg.putUserProperty("key", RandomUtils.getCheseWord(10 * 1024));
    SendResult sendResult = null;
    try {
        sendResult = producer.send(msg);
    } catch (Exception e) {
    }
    assertThat(sendResult.getSendStatus()).isEqualTo(SendStatus.SEND_OK);
}
 
Example #22
Source File: MessageExceptionIT.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
@Test
public void testSendMsgWithUserProperty() {
    Message msg = MessageFactory.getRandomMessage(topic);
    msg.putUserProperty("key", RandomUtils.getCheseWord(10 * 1024));
    SendResult sendResult = null;
    try {
        sendResult = producer.send(msg);
    } catch (Exception e) {
    }
    assertThat(sendResult.getSendStatus()).isEqualTo(SendStatus.SEND_OK);
}
 
Example #23
Source File: ChinaPropIT.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test(expected = org.apache.rocketmq.client.exception.MQBrokerException.class)
public void testSend20kChinaPropMsg() throws Exception {
    Message msg = MessageFactory.getRandomMessage(topic);
    msg.putUserProperty("key", RandomUtils.getCheseWord(32 * 1024 + 1));
    producer.send(msg);
}
 
Example #24
Source File: ChinaPropIT.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test
public void testSend10kChinaPropMsg() {

    Message msg = MessageFactory.getRandomMessage(topic);
    msg.putUserProperty("key", RandomUtils.getCheseWord(10 * 1024));
    SendResult sendResult = null;
    try {
        sendResult = producer.send(msg);
    } catch (Exception e) {
    }
    assertThat(sendResult.getSendStatus()).isEqualTo(SendStatus.SEND_OK);
}
 
Example #25
Source File: MessageExceptionIT.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void testSendMsgWithUserProperty() {
    Message msg = MessageFactory.getRandomMessage(topic);
    msg.putUserProperty("key", RandomUtils.getCheseWord(10 * 1024));
    SendResult sendResult = null;
    try {
        sendResult = producer.send(msg);
    } catch (Exception e) {
    }
    assertThat(sendResult.getSendStatus()).isEqualTo(SendStatus.SEND_OK);
}
 
Example #26
Source File: ChinaPropIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test(expected = org.apache.rocketmq.client.exception.MQBrokerException.class)
public void testSend20kChinaPropMsg() throws Exception {
    Message msg = MessageFactory.getRandomMessage(topic);
    msg.putUserProperty("key", RandomUtils.getCheseWord(32 * 1024 + 1));
    producer.send(msg);
}
 
Example #27
Source File: MessageExceptionIT.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Test
public void testSendMsgWithUserProperty() {
    Message msg = MessageFactory.getRandomMessage(topic);
    msg.putUserProperty("key", RandomUtils.getCheseWord(10 * 1024));
    SendResult sendResult = null;
    try {
        sendResult = producer.send(msg);
    } catch (Exception e) {
    }
    assertThat(sendResult.getSendStatus()).isEqualTo(SendStatus.SEND_OK);
}
 
Example #28
Source File: ChinaPropIT.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test
public void testSend10kChinaPropMsg() {

    Message msg = MessageFactory.getRandomMessage(topic);
    msg.putUserProperty("key", RandomUtils.getCheseWord(10 * 1024));
    SendResult sendResult = null;
    try {
        sendResult = producer.send(msg);
    } catch (Exception e) {
    }
    assertThat(sendResult.getSendStatus()).isEqualTo(SendStatus.SEND_OK);
}
 
Example #29
Source File: ChinaPropIT.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
/**
 * @since version3.4.6
 */
@Test(expected = org.apache.rocketmq.client.exception.MQBrokerException.class)
public void testSend20kChinaPropMsg() throws Exception {
    Message msg = MessageFactory.getRandomMessage(topic);
    msg.putUserProperty("key", RandomUtils.getCheseWord(32 * 1024 + 1));
    producer.send(msg);
}
 
Example #30
Source File: MessageExceptionIT.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void testSendMsgWithUserProperty() {
    Message msg = MessageFactory.getRandomMessage(topic);
    msg.putUserProperty("key", RandomUtils.getCheseWord(10 * 1024));
    SendResult sendResult = null;
    try {
        sendResult = producer.send(msg);
    } catch (Exception e) {
    }
    assertThat(sendResult.getSendStatus()).isEqualTo(SendStatus.SEND_OK);
}