org.apache.rocketmq.test.util.RandomUtil Java Examples

The following examples show how to use org.apache.rocketmq.test.util.RandomUtil. 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: RMQAsyncSendProducer.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
private void create() {
    producer = new DefaultMQProducer();
    producer.setProducerGroup(RandomUtil.getStringByUUID());
    producer.setInstanceName(RandomUtil.getStringByUUID());

    if (nsAddr != null) {
        producer.setNamesrvAddr(nsAddr);
    }

}
 
Example #2
Source File: RMQAsyncSendProducer.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public void asyncSend(int msgSize) {
    this.msgSize = msgSize;

    for (int i = 0; i < msgSize; i++) {
        Message msg = new Message(topic, RandomUtil.getStringByUUID().getBytes());
        this.asyncSend(msg);
    }
}
 
Example #3
Source File: RMQAsyncSendProducer.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
public void asyncSend(int msgSize, MessageQueue mq) {
    this.msgSize = msgSize;
    for (int i = 0; i < msgSize; i++) {
        Message msg = new Message(topic, RandomUtil.getStringByUUID().getBytes());
        this.asyncSend(msg, mq);
    }
}
 
Example #4
Source File: RMQAsyncSendProducer.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public void asyncSend(int msgSize, MessageQueue mq) {
    this.msgSize = msgSize;
    for (int i = 0; i < msgSize; i++) {
        Message msg = new Message(topic, RandomUtil.getStringByUUID().getBytes());
        this.asyncSend(msg, mq);
    }
}
 
Example #5
Source File: RMQAsyncSendProducer.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
public void asyncSend(int msgSize, MessageQueue mq) {
    this.msgSize = msgSize;
    for (int i = 0; i < msgSize; i++) {
        Message msg = new Message(topic, RandomUtil.getStringByUUID().getBytes());
        this.asyncSend(msg, mq);
    }
}
 
Example #6
Source File: MQMessageFactory.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
public static List<Object> getKeyMsg(String topic, String key, int msgSize) {
    List<Object> msgs = new ArrayList<Object>();
    for (int i = 0; i < msgSize; i++) {
        Message msg = new Message(topic, null, key, RandomUtil.getStringByUUID().getBytes());
        msgs.add(msg);
    }
    return msgs;
}
 
Example #7
Source File: RMQAsyncSendProducer.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public void asyncSend(int msgSize, MessageQueueSelector selector) {
    this.msgSize = msgSize;
    for (int i = 0; i < msgSize; i++) {
        Message msg = new Message(topic, RandomUtil.getStringByUUID().getBytes());
        this.asyncSend(msg, selector, i);
    }
}
 
Example #8
Source File: MQMessageFactory.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public static List<Object> getRMQMessage(String tag, String topic, int msgSize) {
    List<Object> msgs = new ArrayList<Object>();
    for (int i = 0; i < msgSize; i++) {
        msgs.add(new Message(topic, tag, RandomUtil.getStringByUUID().getBytes()));
    }

    return msgs;
}
 
Example #9
Source File: MQMessageFactory.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public static List<Object> getRMQMessage(List<String> tags, String topic, int msgSize) {
    List<Object> msgs = new ArrayList<Object>();
    for (int i = 0; i < msgSize; i++) {
        for (String tag : tags) {
            msgs.add(new Message(topic, tag, RandomUtil.getStringByUUID().getBytes()));
        }
    }
    return msgs;
}
 
Example #10
Source File: MQMessageFactory.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public static List<Object> getDelayMsg(String topic, int delayLevel, int msgSize) {
    List<Object> msgs = new ArrayList<Object>();
    for (int i = 0; i < msgSize; i++) {
        Message msg = new Message(topic, RandomUtil.getStringByUUID().getBytes());
        msg.setDelayTimeLevel(delayLevel);
        msgs.add(msg);
    }
    return msgs;
}
 
Example #11
Source File: MQMessageFactory.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public static List<Object> getKeyMsg(String topic, String key, int msgSize) {
    List<Object> msgs = new ArrayList<Object>();
    for (int i = 0; i < msgSize; i++) {
        Message msg = new Message(topic, null, key, RandomUtil.getStringByUUID().getBytes());
        msgs.add(msg);
    }
    return msgs;
}
 
Example #12
Source File: ProducerFactory.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public static DefaultMQProducer getRMQProducer(String ns) {
    DefaultMQProducer producer = new DefaultMQProducer(RandomUtil.getStringByUUID());
    producer.setNamesrvAddr(ns);
    try {
        producer.start();
    } catch (MQClientException e) {
        e.printStackTrace();
    }

    return producer;
}
 
Example #13
Source File: MQCollector.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public MQCollector() {
    msgBodys = DataCollectorManager.getInstance()
        .fetchListDataCollector(RandomUtil.getStringByUUID());
    originMsgs = DataCollectorManager.getInstance()
        .fetchListDataCollector(RandomUtil.getStringByUUID());
    errorMsgs = DataCollectorManager.getInstance()
        .fetchListDataCollector(RandomUtil.getStringByUUID());
    originMsgIndex = new ConcurrentHashMap<Object, Object>();
    msgRTs = DataCollectorManager.getInstance()
        .fetchListDataCollector(RandomUtil.getStringByUUID());
}
 
Example #14
Source File: AbstractMQProducer.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public Object getMessageByTag(String tag) {
    Object objMsg = null;
    if (this instanceof RMQNormalProducer) {
        org.apache.rocketmq.common.message.Message msg = new org.apache.rocketmq.common.message.Message(
            topic, (RandomUtil.getStringByUUID() + "." + new Date()).getBytes());
        objMsg = msg;
        if (tag != null) {
            msg.setTags(tag);
        }
    }
    return objMsg;
}
 
Example #15
Source File: AbstractMQProducer.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
public AbstractMQProducer(String topic) {
    super();
    producerGroupName = RandomUtil.getStringByUUID();
    producerInstanceName = RandomUtil.getStringByUUID();
    this.topic = topic;

}
 
Example #16
Source File: RMQAsyncSendProducer.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
public void asyncSend(int msgSize) {
    this.msgSize = msgSize;

    for (int i = 0; i < msgSize; i++) {
        Message msg = new Message(topic, RandomUtil.getStringByUUID().getBytes());
        this.asyncSend(msg);
    }
}
 
Example #17
Source File: ProducerFactory.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
public static DefaultMQProducer getRMQProducer(String ns) {
    DefaultMQProducer producer = new DefaultMQProducer(RandomUtil.getStringByUUID());
    producer.setNamesrvAddr(ns);
    try {
        producer.start();
    } catch (MQClientException e) {
        e.printStackTrace();
    }

    return producer;
}
 
Example #18
Source File: AbstractMQProducer.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
public Object getMessageByTag(String tag) {
    Object objMsg = null;
    if (this instanceof RMQNormalProducer) {
        org.apache.rocketmq.common.message.Message msg = new org.apache.rocketmq.common.message.Message(
            topic, (RandomUtil.getStringByUUID() + "." + new Date()).getBytes());
        objMsg = msg;
        if (tag != null) {
            msg.setTags(tag);
        }
    }
    return objMsg;
}
 
Example #19
Source File: RMQAsyncSendProducer.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
private void create() {
    producer = new DefaultMQProducer();
    producer.setProducerGroup(RandomUtil.getStringByUUID());
    producer.setInstanceName(RandomUtil.getStringByUUID());

    if (nsAddr != null) {
        producer.setNamesrvAddr(nsAddr);
    }

}
 
Example #20
Source File: MQCollector.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
public MQCollector() {
    msgBodys = DataCollectorManager.getInstance()
        .fetchListDataCollector(RandomUtil.getStringByUUID());
    originMsgs = DataCollectorManager.getInstance()
        .fetchListDataCollector(RandomUtil.getStringByUUID());
    errorMsgs = DataCollectorManager.getInstance()
        .fetchListDataCollector(RandomUtil.getStringByUUID());
    originMsgIndex = new ConcurrentHashMap<Object, Object>();
    msgRTs = DataCollectorManager.getInstance()
        .fetchListDataCollector(RandomUtil.getStringByUUID());
}
 
Example #21
Source File: MQMessageFactory.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
public static List<Object> getDelayMsg(String topic, int delayLevel, int msgSize) {
    List<Object> msgs = new ArrayList<Object>();
    for (int i = 0; i < msgSize; i++) {
        Message msg = new Message(topic, RandomUtil.getStringByUUID().getBytes());
        msg.setDelayTimeLevel(delayLevel);
        msgs.add(msg);
    }
    return msgs;
}
 
Example #22
Source File: RMQAsyncSendProducer.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public void asyncSend(int msgSize, MessageQueueSelector selector) {
    this.msgSize = msgSize;
    for (int i = 0; i < msgSize; i++) {
        Message msg = new Message(topic, RandomUtil.getStringByUUID().getBytes());
        this.asyncSend(msg, selector, i);
    }
}
 
Example #23
Source File: MQMessageFactory.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
public static List<Object> getDelayMsg(String topic, int delayLevel, int msgSize) {
    List<Object> msgs = new ArrayList<Object>();
    for (int i = 0; i < msgSize; i++) {
        Message msg = new Message(topic, RandomUtil.getStringByUUID().getBytes());
        msg.setDelayTimeLevel(delayLevel);
        msgs.add(msg);
    }
    return msgs;
}
 
Example #24
Source File: AbstractMQProducer.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
public AbstractMQProducer(String topic) {
    super();
    producerGroupName = RandomUtil.getStringByUUID();
    producerInstanceName = RandomUtil.getStringByUUID();
    this.topic = topic;

}
 
Example #25
Source File: MQMessageFactory.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
public static List<Object> getRMQMessage(String tag, String topic, int msgSize) {
    List<Object> msgs = new ArrayList<Object>();
    for (int i = 0; i < msgSize; i++) {
        msgs.add(new Message(topic, tag, RandomUtil.getStringByUUID().getBytes()));
    }

    return msgs;
}
 
Example #26
Source File: MQMessageFactory.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
public static List<Object> getRMQMessage(List<String> tags, String topic, int msgSize) {
    List<Object> msgs = new ArrayList<Object>();
    for (int i = 0; i < msgSize; i++) {
        for (String tag : tags) {
            msgs.add(new Message(topic, tag, RandomUtil.getStringByUUID().getBytes()));
        }
    }
    return msgs;
}
 
Example #27
Source File: MQCollector.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
public MQCollector() {
    msgBodys = DataCollectorManager.getInstance()
        .fetchListDataCollector(RandomUtil.getStringByUUID());
    originMsgs = DataCollectorManager.getInstance()
        .fetchListDataCollector(RandomUtil.getStringByUUID());
    errorMsgs = DataCollectorManager.getInstance()
        .fetchListDataCollector(RandomUtil.getStringByUUID());
    originMsgIndex = new ConcurrentHashMap<Object, Object>();
    msgRTs = DataCollectorManager.getInstance()
        .fetchListDataCollector(RandomUtil.getStringByUUID());
}
 
Example #28
Source File: RMQAsyncSendProducer.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
private void create() {
    producer = new DefaultMQProducer();
    producer.setProducerGroup(RandomUtil.getStringByUUID());
    producer.setInstanceName(RandomUtil.getStringByUUID());

    if (nsAddr != null) {
        producer.setNamesrvAddr(nsAddr);
    }

}
 
Example #29
Source File: MQCollector.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public MQCollector() {
    msgBodys = DataCollectorManager.getInstance()
        .fetchListDataCollector(RandomUtil.getStringByUUID());
    originMsgs = DataCollectorManager.getInstance()
        .fetchListDataCollector(RandomUtil.getStringByUUID());
    errorMsgs = DataCollectorManager.getInstance()
        .fetchListDataCollector(RandomUtil.getStringByUUID());
    originMsgIndex = new ConcurrentHashMap<Object, Object>();
    msgRTs = DataCollectorManager.getInstance()
        .fetchListDataCollector(RandomUtil.getStringByUUID());
}
 
Example #30
Source File: RMQAsyncSendProducer.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
private void create() {
    producer = new DefaultMQProducer();
    producer.setProducerGroup(RandomUtil.getStringByUUID());
    producer.setInstanceName(RandomUtil.getStringByUUID());

    if (nsAddr != null) {
        producer.setNamesrvAddr(nsAddr);
    }

}