org.apache.rocketmq.common.protocol.heartbeat.ProducerData Java Examples
The following examples show how to use
org.apache.rocketmq.common.protocol.heartbeat.ProducerData.
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: PlainAccessValidatorTest.java From rocketmq with Apache License 2.0 | 5 votes |
@Test public void validateHeartBeatTest() { HeartbeatData heartbeatData=new HeartbeatData(); Set<ProducerData> producerDataSet=new HashSet<>(); Set<ConsumerData> consumerDataSet=new HashSet<>(); Set<SubscriptionData> subscriptionDataSet=new HashSet<>(); ProducerData producerData=new ProducerData(); producerData.setGroupName("producerGroupA"); ConsumerData consumerData=new ConsumerData(); consumerData.setGroupName("consumerGroupA"); SubscriptionData subscriptionData=new SubscriptionData(); subscriptionData.setTopic("topicC"); producerDataSet.add(producerData); consumerDataSet.add(consumerData); subscriptionDataSet.add(subscriptionData); consumerData.setSubscriptionDataSet(subscriptionDataSet); heartbeatData.setProducerDataSet(producerDataSet); heartbeatData.setConsumerDataSet(consumerDataSet); RemotingCommand remotingCommand = RemotingCommand.createRequestCommand(RequestCode.HEART_BEAT,null); remotingCommand.setBody(heartbeatData.encode()); aclClient.doBeforeRequest("", remotingCommand); ByteBuffer buf = remotingCommand.encode(); buf.getInt(); buf = ByteBuffer.allocate(buf.limit() - buf.position()).put(buf); buf.position(0); PlainAccessResource accessResource = (PlainAccessResource) plainAccessValidator.parse(RemotingCommand.decode(buf), "192.168.0.1:9876"); plainAccessValidator.validate(accessResource); }