Java Code Examples for org.apache.rocketmq.remoting.protocol.LanguageCode#JAVA

The following examples show how to use org.apache.rocketmq.remoting.protocol.LanguageCode#JAVA . 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: ClientManageProcessorTest.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    when(handlerContext.channel()).thenReturn(channel);
    clientManageProcessor = new ClientManageProcessor(brokerController);
    clientChannelInfo = new ClientChannelInfo(channel, clientId, LanguageCode.JAVA, 100);
    brokerController.getProducerManager().registerProducer(group, clientChannelInfo);

    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example 2
Source File: ClientManageProcessorTest.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    when(handlerContext.channel()).thenReturn(channel);
    clientManageProcessor = new ClientManageProcessor(brokerController);
    clientChannelInfo = new ClientChannelInfo(channel, clientId, LanguageCode.JAVA, 100);
    brokerController.getProducerManager().registerProducer(group, clientChannelInfo);

    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example 3
Source File: ConsumeQueueManagerTest.java    From DeFiBus with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetMinAccumulated() throws Exception {
    clientChannelInfo = new ClientChannelInfo(channel, clientId, LanguageCode.JAVA, 100);
    ConsumerData consumerData = createConsumerData(group, topic);
    deFiBrokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
    deFiBrokerController.getConsumerOffsetManager().commitOffset(clientId, group, topic, queueId, offSet);
    consumeQueueManager.setBrokerController(deFiBrokerController);
    when(messageStore.getMaxOffsetInQueue(topic, queueId)).thenReturn(1025L);
    ConsumeQueueWaterMark mark = consumeQueueManager.getMinAccumulated(topic, queueId);
    assertThat(mark).isNotNull();
    assertThat(mark.getTopic()).isEqualTo(topic);
    assertThat(mark.getConsumerGroup()).isEqualTo(group);
    assertThat(mark.getAccumulated()).isEqualTo(1);
}
 
Example 4
Source File: DeFiPullMessageProcessorTest.java    From DeFiBus with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    deFiBrokerController.setMessageStore(messageStore);
    deFiPullMessageProcessor = new DeFiPullMessageProcessor(deFiBrokerController);
    Channel mockChannel = mock(Channel.class);
    when(handlerContext.channel()).thenReturn(mockChannel);
    deFiBrokerController.getTopicConfigManager().getTopicConfigTable().put(topic, new TopicConfig());
    clientChannelInfo = new ClientChannelInfo(mockChannel, clientId, LanguageCode.JAVA, 100);
    ConsumerData consumerData = createConsumerData(group, topic);
    deFiBrokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example 5
Source File: ClientManageProcessorTest.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    when(handlerContext.channel()).thenReturn(channel);
    clientManageProcessor = new ClientManageProcessor(brokerController);
    clientChannelInfo = new ClientChannelInfo(channel, clientId, LanguageCode.JAVA, 100);
    brokerController.getProducerManager().registerProducer(group, clientChannelInfo);

    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example 6
Source File: ClientManageProcessorTest.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    when(handlerContext.channel()).thenReturn(channel);
    clientManageProcessor = new ClientManageProcessor(brokerController);
    clientChannelInfo = new ClientChannelInfo(channel, clientId, LanguageCode.JAVA, 100);
    brokerController.getProducerManager().registerProducer(group, clientChannelInfo);

    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example 7
Source File: ClientManageProcessorTest.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    when(handlerContext.channel()).thenReturn(channel);
    clientManageProcessor = new ClientManageProcessor(brokerController);
    clientChannelInfo = new ClientChannelInfo(channel, clientId, LanguageCode.JAVA, 100);
    brokerController.getProducerManager().registerProducer(group, clientChannelInfo);

    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example 8
Source File: ClientManageProcessorTest.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    when(handlerContext.channel()).thenReturn(channel);
    clientManageProcessor = new ClientManageProcessor(brokerController);
    clientChannelInfo = new ClientChannelInfo(channel, clientId, LanguageCode.JAVA, 100);
    brokerController.getProducerManager().registerProducer(group, clientChannelInfo);

    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example 9
Source File: ClientManageProcessorTest.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    when(handlerContext.channel()).thenReturn(channel);
    clientManageProcessor = new ClientManageProcessor(brokerController);
    clientChannelInfo = new ClientChannelInfo(channel, clientId, LanguageCode.JAVA, 100);
    brokerController.getProducerManager().registerProducer(group, clientChannelInfo);

    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example 10
Source File: ClientManageProcessorTest.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    when(handlerContext.channel()).thenReturn(channel);
    clientManageProcessor = new ClientManageProcessor(brokerController);
    clientChannelInfo = new ClientChannelInfo(channel, clientId, LanguageCode.JAVA, 100);
    brokerController.getProducerManager().registerProducer(group, clientChannelInfo);

    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example 11
Source File: DeFiClientManageProcessorTest.java    From DeFiBus with Apache License 2.0 5 votes vote down vote up
@Before
public void init() {
    // when(handlerContext.channel()).thenReturn(channel);
    deFiClientManageProcessor = new DeFiClientManageProcessor(deFiBrokerController);
    clientChannelInfo = new ClientChannelInfo(channel, clientId, LanguageCode.JAVA, 100);
    ConsumerData consumerData = createConsumerData(group, topic);
    deFiBrokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example 12
Source File: DeFiConsumerManagerTest.java    From DeFiBus with Apache License 2.0 5 votes vote down vote up
@Before
public void init() {
    deFiConsumerManager = new DeFiConsumerManager(consumerIdsChangeListener, adjustQueueNumStrategy);
    mockChannel = mock(Channel.class);
    clientChannelInfo = new ClientChannelInfo(mockChannel, clientId, LanguageCode.JAVA, 100);
    consumerData = createConsumerData(group, topic);
    deFiConsumerManager.registerConsumer(consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example 13
Source File: ReplyMessageProcessorTest.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Before
public void init() throws IllegalAccessException, NoSuchFieldException {
    clientInfo = new ClientChannelInfo(channel, "127.0.0.1", LanguageCode.JAVA, 0);
    brokerController.setMessageStore(messageStore);
    Field field = BrokerController.class.getDeclaredField("broker2Client");
    field.setAccessible(true);
    field.set(brokerController, broker2Client);
    when(messageStore.now()).thenReturn(System.currentTimeMillis());
    Channel mockChannel = mock(Channel.class);
    when(mockChannel.remoteAddress()).thenReturn(new InetSocketAddress(1024));
    when(handlerContext.channel()).thenReturn(mockChannel);
    replyMessageProcessor = new ReplyMessageProcessor(brokerController);
}
 
Example 14
Source File: DeFiProducerManagerTest.java    From DeFiBus with Apache License 2.0 4 votes vote down vote up
@Before
public void init() {
    deFiProducerManager = new DeFiProducerManager();
    clientInfo = new ClientChannelInfo(channel, "ClientIdTest", LanguageCode.JAVA, 1);

}
 
Example 15
Source File: ProducerManagerTest.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
@Before
public void init() {
    producerManager = new ProducerManager();
    clientInfo = new ClientChannelInfo(channel, "clientId", LanguageCode.JAVA, 0);
}