Search in sources :

Example 1 with ProducerConnection

use of org.apache.rocketmq.common.protocol.body.ProducerConnection in project rocketmq-externals by apache.

the class ProducerServiceImplTest method getProducerConnection.

@Test
public void getProducerConnection() throws Exception {
    ProducerConnection producerConnection = new RetryTempLate<ProducerConnection>() {

        @Override
        protected ProducerConnection process() throws Exception {
            return producerService.getProducerConnection(TEST_PRODUCER_GROUP, TEST_CONSOLE_TOPIC);
        }
    }.execute(10, 1000);
    Assert.assertNotNull(producerConnection);
    Assert.assertTrue(Lists.transform(Lists.newArrayList(producerConnection.getConnectionSet()), new Function<Connection, String>() {

        @Override
        public String apply(Connection input) {
            return input.getClientAddr().split(":")[0];
        }
    }).contains(TestConstant.LOCAL_HOST));
}
Also used : ProducerConnection(org.apache.rocketmq.common.protocol.body.ProducerConnection) Connection(org.apache.rocketmq.common.protocol.body.Connection) ProducerConnection(org.apache.rocketmq.common.protocol.body.ProducerConnection) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 2 with ProducerConnection

use of org.apache.rocketmq.common.protocol.body.ProducerConnection in project rocketmq-externals by apache.

the class ProducerController method producerConnection.

@RequestMapping(value = "/producerConnection.query", method = { RequestMethod.GET })
@ResponseBody
public Object producerConnection(@RequestParam String producerGroup, @RequestParam String topic) {
    ProducerConnection producerConnection = producerService.getProducerConnection(producerGroup, topic);
    producerConnection.setConnectionSet(ConnectionInfo.buildConnectionInfoHashSet(producerConnection.getConnectionSet()));
    return producerConnection;
}
Also used : ProducerConnection(org.apache.rocketmq.common.protocol.body.ProducerConnection) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

ProducerConnection (org.apache.rocketmq.common.protocol.body.ProducerConnection)2 Connection (org.apache.rocketmq.common.protocol.body.Connection)1 Test (org.junit.Test)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1