org.apache.rocketmq.common.filter.FilterAPI Java Examples
The following examples show how to use
org.apache.rocketmq.common.filter.FilterAPI.
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: DefaultMQPushConsumerImpl.java From DDMQ with Apache License 2.0 | 6 votes |
public void subscribe(String topic, String fullClassName, String filterClassSource) throws MQClientException { try { SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPushConsumer.getConsumerGroup(), topic, "*"); subscriptionData.setSubString(fullClassName); subscriptionData.setClassFilterMode(true); subscriptionData.setFilterClassSource(filterClassSource); this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData); if (this.mQClientFactory != null) { this.mQClientFactory.sendHeartbeatToAllBrokerWithLock(); } } catch (Exception e) { throw new MQClientException("subscription exception", e); } }
Example #2
Source File: DefaultMQPushConsumerImpl.java From rocketmq with Apache License 2.0 | 6 votes |
public void subscribe(final String topic, final MessageSelector messageSelector) throws MQClientException { try { if (messageSelector == null) { subscribe(topic, SubscriptionData.SUB_ALL); return; } SubscriptionData subscriptionData = FilterAPI.build(topic, messageSelector.getExpression(), messageSelector.getExpressionType()); this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData); if (this.mQClientFactory != null) { this.mQClientFactory.sendHeartbeatToAllBrokerWithLock(); } } catch (Exception e) { throw new MQClientException("subscription exception", e); } }
Example #3
Source File: DefaultMQPullConsumerImpl.java From rocketmq-read with Apache License 2.0 | 6 votes |
@Override public Set<SubscriptionData> subscriptions() { Set<SubscriptionData> result = new HashSet<SubscriptionData>(); Set<String> topics = this.defaultMQPullConsumer.getRegisterTopics(); if (topics != null) { synchronized (topics) { for (String t : topics) { SubscriptionData ms = null; try { ms = FilterAPI.buildSubscriptionData(this.groupName(), t, SubscriptionData.SUB_ALL); } catch (Exception e) { log.error("parse subscription error", e); } ms.setSubVersion(0L); result.add(ms); } } } return result; }
Example #4
Source File: DynaCode.java From rocketmq with Apache License 2.0 | 6 votes |
public static Class<?> compileAndLoadClass(final String className, final String javaSource) throws Exception { String classSimpleName = FilterAPI.simpleClassName(className); String javaCode = javaSource; final String newClassSimpleName = classSimpleName + System.currentTimeMillis(); String newJavaCode = javaCode.replaceAll(classSimpleName, newClassSimpleName); List<String> codes = new ArrayList<String>(); codes.add(newJavaCode); DynaCode dc = new DynaCode(codes); dc.compileAndLoadClass(); Map<String, Class<?>> map = dc.getLoadClass(); Class<?> clazz = map.get(getQualifiedName(newJavaCode)); return clazz; }
Example #5
Source File: DefaultMQPushConsumerImpl.java From rocketmq with Apache License 2.0 | 6 votes |
public void subscribe(String topic, String fullClassName, String filterClassSource) throws MQClientException { try { SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPushConsumer.getConsumerGroup(), // topic, "*"); subscriptionData.setSubString(fullClassName); subscriptionData.setClassFilterMode(true); subscriptionData.setFilterClassSource(filterClassSource); this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData); if (this.mQClientFactory != null) { this.mQClientFactory.sendHeartbeatToAllBrokerWithLock(); } } catch (Exception e) { throw new MQClientException("subscription exception", e); } }
Example #6
Source File: DefaultMQPullConsumerImpl.java From rocketmq_trans_message with Apache License 2.0 | 6 votes |
@Override public Set<SubscriptionData> subscriptions() { Set<SubscriptionData> result = new HashSet<SubscriptionData>(); Set<String> topics = this.defaultMQPullConsumer.getRegisterTopics(); if (topics != null) { synchronized (topics) { for (String t : topics) { SubscriptionData ms = null; try { ms = FilterAPI.buildSubscriptionData(this.groupName(), t, SubscriptionData.SUB_ALL); } catch (Exception e) { log.error("parse subscription error", e); } ms.setSubVersion(0L); result.add(ms); } } } return result; }
Example #7
Source File: DefaultMQPullConsumerImpl.java From rocketmq with Apache License 2.0 | 6 votes |
@Override public Set<SubscriptionData> subscriptions() { Set<SubscriptionData> result = new HashSet<SubscriptionData>(); Set<String> topics = this.defaultMQPullConsumer.getRegisterTopics(); if (topics != null) { synchronized (topics) { for (String t : topics) { SubscriptionData ms = null; try { ms = FilterAPI.buildSubscriptionData(this.groupName(), t, SubscriptionData.SUB_ALL); } catch (Exception e) { log.error("parse subscription error", e); } ms.setSubVersion(0L); result.add(ms); } } } return result; }
Example #8
Source File: DynaCode.java From DDMQ with Apache License 2.0 | 6 votes |
public static Class<?> compileAndLoadClass(final String className, final String javaSource) throws Exception { String classSimpleName = FilterAPI.simpleClassName(className); String javaCode = javaSource; final String newClassSimpleName = classSimpleName + System.currentTimeMillis(); String newJavaCode = javaCode.replaceAll(classSimpleName, newClassSimpleName); List<String> codes = new ArrayList<String>(); codes.add(newJavaCode); DynaCode dc = new DynaCode(codes); dc.compileAndLoadClass(); Map<String, Class<?>> map = dc.getLoadClass(); Class<?> clazz = map.get(getQualifiedName(newJavaCode)); return clazz; }
Example #9
Source File: DefaultMQPushConsumerImpl.java From rocketmq_trans_message with Apache License 2.0 | 6 votes |
public void subscribe(String topic, String fullClassName, String filterClassSource) throws MQClientException { try { SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPushConsumer.getConsumerGroup(), // topic, "*"); subscriptionData.setSubString(fullClassName); subscriptionData.setClassFilterMode(true); subscriptionData.setFilterClassSource(filterClassSource); this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData); if (this.mQClientFactory != null) { this.mQClientFactory.sendHeartbeatToAllBrokerWithLock(); } } catch (Exception e) { throw new MQClientException("subscription exception", e); } }
Example #10
Source File: DefaultMQPushConsumerImpl.java From rocketmq with Apache License 2.0 | 6 votes |
public void subscribe(String topic, String fullClassName, String filterClassSource) throws MQClientException { try { SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPushConsumer.getConsumerGroup(), topic, "*"); subscriptionData.setSubString(fullClassName); subscriptionData.setClassFilterMode(true); subscriptionData.setFilterClassSource(filterClassSource); this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData); if (this.mQClientFactory != null) { this.mQClientFactory.sendHeartbeatToAllBrokerWithLock(); } } catch (Exception e) { throw new MQClientException("subscription exception", e); } }
Example #11
Source File: DefaultMQPushConsumerImpl.java From DDMQ with Apache License 2.0 | 6 votes |
public void subscribe(final String topic, final MessageSelector messageSelector) throws MQClientException { try { if (messageSelector == null) { subscribe(topic, SubscriptionData.SUB_ALL); return; } SubscriptionData subscriptionData = FilterAPI.build(topic, messageSelector.getExpression(), messageSelector.getExpressionType()); this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData); if (this.mQClientFactory != null) { this.mQClientFactory.sendHeartbeatToAllBrokerWithLock(); } } catch (Exception e) { throw new MQClientException("subscription exception", e); } }
Example #12
Source File: DefaultMQPullConsumerImpl.java From DDMQ with Apache License 2.0 | 6 votes |
@Override public Set<SubscriptionData> subscriptions() { Set<SubscriptionData> result = new HashSet<SubscriptionData>(); Set<String> topics = this.defaultMQPullConsumer.getRegisterTopics(); if (topics != null) { synchronized (topics) { for (String t : topics) { SubscriptionData ms = null; try { ms = FilterAPI.buildSubscriptionData(this.groupName(), t, SubscriptionData.SUB_ALL); } catch (Exception e) { log.error("parse subscription error", e); } ms.setSubVersion(0L); result.add(ms); } } } return result; }
Example #13
Source File: DynaCode.java From rocketmq_trans_message with Apache License 2.0 | 6 votes |
public static Class<?> compileAndLoadClass(final String className, final String javaSource) throws Exception { String classSimpleName = FilterAPI.simpleClassName(className); String javaCode = javaSource; final String newClassSimpleName = classSimpleName + System.currentTimeMillis(); String newJavaCode = javaCode.replaceAll(classSimpleName, newClassSimpleName); List<String> codes = new ArrayList<String>(); codes.add(newJavaCode); DynaCode dc = new DynaCode(codes); dc.compileAndLoadClass(); Map<String, Class<?>> map = dc.getLoadClass(); Class<?> clazz = map.get(getQualifiedName(newJavaCode)); return clazz; }
Example #14
Source File: DynaCode.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 6 votes |
public static Class<?> compileAndLoadClass(final String className, final String javaSource) throws Exception { String classSimpleName = FilterAPI.simpleClassName(className); String javaCode = javaSource; final String newClassSimpleName = classSimpleName + System.currentTimeMillis(); String newJavaCode = javaCode.replaceAll(classSimpleName, newClassSimpleName); List<String> codes = new ArrayList<String>(); codes.add(newJavaCode); DynaCode dc = new DynaCode(codes); dc.compileAndLoadClass(); Map<String, Class<?>> map = dc.getLoadClass(); Class<?> clazz = map.get(getQualifiedName(newJavaCode)); return clazz; }
Example #15
Source File: DefaultMQPushConsumerImpl.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 6 votes |
public void subscribe(String topic, String fullClassName, String filterClassSource) throws MQClientException { try { SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPushConsumer.getConsumerGroup(), // topic, "*"); subscriptionData.setSubString(fullClassName); subscriptionData.setClassFilterMode(true); subscriptionData.setFilterClassSource(filterClassSource); this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData); if (this.mQClientFactory != null) { this.mQClientFactory.sendHeartbeatToAllBrokerWithLock(); } } catch (Exception e) { throw new MQClientException("subscription exception", e); } }
Example #16
Source File: DefaultMQPushConsumerImpl.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 6 votes |
public void subscribe(final String topic, final MessageSelector messageSelector) throws MQClientException { try { if (messageSelector == null) { subscribe(topic, SubscriptionData.SUB_ALL); return; } SubscriptionData subscriptionData = FilterAPI.build(topic, messageSelector.getExpression(), messageSelector.getExpressionType()); this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData); if (this.mQClientFactory != null) { this.mQClientFactory.sendHeartbeatToAllBrokerWithLock(); } } catch (Exception e) { throw new MQClientException("subscription exception", e); } }
Example #17
Source File: DefaultMQPullConsumerImpl.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 6 votes |
@Override public Set<SubscriptionData> subscriptions() { Set<SubscriptionData> result = new HashSet<SubscriptionData>(); Set<String> topics = this.defaultMQPullConsumer.getRegisterTopics(); if (topics != null) { synchronized (topics) { for (String t : topics) { SubscriptionData ms = null; try { ms = FilterAPI.buildSubscriptionData(this.groupName(), t, SubscriptionData.SUB_ALL); } catch (Exception e) { log.error("parse subscription error", e); } ms.setSubVersion(0L); result.add(ms); } } } return result; }
Example #18
Source File: DefaultMQPushConsumerImpl.java From rocketmq-4.3.0 with Apache License 2.0 | 6 votes |
public void subscribe(String topic, String fullClassName, String filterClassSource) throws MQClientException { try { SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPushConsumer.getConsumerGroup(), topic, "*"); subscriptionData.setSubString(fullClassName); subscriptionData.setClassFilterMode(true); subscriptionData.setFilterClassSource(filterClassSource); this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData); if (this.mQClientFactory != null) { this.mQClientFactory.sendHeartbeatToAllBrokerWithLock(); } } catch (Exception e) { throw new MQClientException("subscription exception", e); } }
Example #19
Source File: DynaCode.java From DDMQ with Apache License 2.0 | 6 votes |
public static Class<?> compileAndLoadClass(final String className, final String javaSource) throws Exception { String classSimpleName = FilterAPI.simpleClassName(className); String javaCode = javaSource; final String newClassSimpleName = classSimpleName + System.currentTimeMillis(); String newJavaCode = javaCode.replaceAll(classSimpleName, newClassSimpleName); List<String> codes = new ArrayList<String>(); codes.add(newJavaCode); DynaCode dc = new DynaCode(codes); dc.compileAndLoadClass(); Map<String, Class<?>> map = dc.getLoadClass(); Class<?> clazz = map.get(getQualifiedName(newJavaCode)); return clazz; }
Example #20
Source File: DefaultMQPushConsumerImpl.java From DDMQ with Apache License 2.0 | 6 votes |
public void subscribe(String topic, String fullClassName, String filterClassSource) throws MQClientException { try { SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPushConsumer.getConsumerGroup(), topic, "*"); subscriptionData.setSubString(fullClassName); subscriptionData.setClassFilterMode(true); subscriptionData.setFilterClassSource(filterClassSource); this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData); if (this.mQClientFactory != null) { this.mQClientFactory.sendHeartbeatToAllBrokerWithLock(); } } catch (Exception e) { throw new MQClientException("subscription exception", e); } }
Example #21
Source File: DefaultMQPushConsumerImpl.java From DDMQ with Apache License 2.0 | 6 votes |
public void subscribe(final String topic, final MessageSelector messageSelector) throws MQClientException { try { if (messageSelector == null) { subscribe(topic, SubscriptionData.SUB_ALL); return; } SubscriptionData subscriptionData = FilterAPI.build(topic, messageSelector.getExpression(), messageSelector.getExpressionType()); this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData); if (this.mQClientFactory != null) { this.mQClientFactory.sendHeartbeatToAllBrokerWithLock(); } } catch (Exception e) { throw new MQClientException("subscription exception", e); } }
Example #22
Source File: DefaultLitePullConsumerImpl.java From rocketmq with Apache License 2.0 | 6 votes |
public synchronized void subscribe(String topic, MessageSelector messageSelector) throws MQClientException { try { if (topic == null || topic.equals("")) { throw new IllegalArgumentException("Topic can not be null or empty."); } setSubscriptionType(SubscriptionType.SUBSCRIBE); if (messageSelector == null) { subscribe(topic, SubscriptionData.SUB_ALL); return; } SubscriptionData subscriptionData = FilterAPI.build(topic, messageSelector.getExpression(), messageSelector.getExpressionType()); this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData); this.defaultLitePullConsumer.setMessageQueueListener(new MessageQueueListenerImpl()); assignedMessageQueue.setRebalanceImpl(this.rebalanceImpl); if (serviceState == ServiceState.RUNNING) { this.mQClientFactory.sendHeartbeatToAllBrokerWithLock(); updateTopicSubscribeInfoWhenSubscriptionChanged(); } } catch (Exception e) { throw new MQClientException("subscribe exception", e); } }
Example #23
Source File: DefaultMQPullConsumerImpl.java From DDMQ with Apache License 2.0 | 6 votes |
@Override public Set<SubscriptionData> subscriptions() { Set<SubscriptionData> result = new HashSet<SubscriptionData>(); Set<String> topics = this.defaultMQPullConsumer.getRegisterTopics(); if (topics != null) { synchronized (topics) { for (String t : topics) { SubscriptionData ms = null; try { ms = FilterAPI.buildSubscriptionData(this.groupName(), t, SubscriptionData.SUB_ALL); } catch (Exception e) { log.error("parse subscription error", e); } ms.setSubVersion(0L); result.add(ms); } } } return result; }
Example #24
Source File: DefaultLitePullConsumerImpl.java From rocketmq with Apache License 2.0 | 6 votes |
public synchronized void subscribe(String topic, String subExpression) throws MQClientException { try { if (topic == null || topic.equals("")) { throw new IllegalArgumentException("Topic can not be null or empty."); } setSubscriptionType(SubscriptionType.SUBSCRIBE); SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(defaultLitePullConsumer.getConsumerGroup(), topic, subExpression); this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData); this.defaultLitePullConsumer.setMessageQueueListener(new MessageQueueListenerImpl()); assignedMessageQueue.setRebalanceImpl(this.rebalanceImpl); if (serviceState == ServiceState.RUNNING) { this.mQClientFactory.sendHeartbeatToAllBrokerWithLock(); updateTopicSubscribeInfoWhenSubscriptionChanged(); } } catch (Exception e) { throw new MQClientException("subscribe exception", e); } }
Example #25
Source File: DefaultMQPullConsumerImpl.java From rocketmq with Apache License 2.0 | 6 votes |
@Override public Set<SubscriptionData> subscriptions() { Set<SubscriptionData> result = new HashSet<SubscriptionData>(); Set<String> topics = this.defaultMQPullConsumer.getRegisterTopics(); if (topics != null) { synchronized (topics) { for (String t : topics) { SubscriptionData ms = null; try { ms = FilterAPI.buildSubscriptionData(this.groupName(), t, SubscriptionData.SUB_ALL); } catch (Exception e) { log.error("parse subscription error", e); } ms.setSubVersion(0L); result.add(ms); } } } return result; }
Example #26
Source File: DefaultMQPushConsumerImpl.java From rocketmq-read with Apache License 2.0 | 6 votes |
/** * subsicribe * @param topic topic * @param messageSelector 消息选择器 * @throws MQClientException ; */ public void subscribe(final String topic, final MessageSelector messageSelector) throws MQClientException { try { if (messageSelector == null) { subscribe(topic, SubscriptionData.SUB_ALL); return; } SubscriptionData subscriptionData = FilterAPI.build(topic, messageSelector.getExpression(), messageSelector.getExpressionType()); this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData); if (this.mQClientFactory != null) { this.mQClientFactory.sendHeartbeatToAllBrokerWithLock(); } } catch (Exception e) { throw new MQClientException("subscription exception", e); } }
Example #27
Source File: DefaultMQPushConsumerImpl.java From rocketmq-4.3.0 with Apache License 2.0 | 6 votes |
public void subscribe(final String topic, final MessageSelector messageSelector) throws MQClientException { try { if (messageSelector == null) { subscribe(topic, SubscriptionData.SUB_ALL); return; } SubscriptionData subscriptionData = FilterAPI.build(topic, messageSelector.getExpression(), messageSelector.getExpressionType()); this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData); if (this.mQClientFactory != null) { this.mQClientFactory.sendHeartbeatToAllBrokerWithLock(); } } catch (Exception e) { throw new MQClientException("subscription exception", e); } }
Example #28
Source File: DefaultMQPullConsumerImpl.java From rocketmq-4.3.0 with Apache License 2.0 | 6 votes |
@Override public Set<SubscriptionData> subscriptions() { Set<SubscriptionData> result = new HashSet<SubscriptionData>(); // 获取注册的topics Set<String> topics = this.defaultMQPullConsumer.getRegisterTopics(); if (topics != null) { synchronized (topics) { for (String t : topics) { SubscriptionData ms = null; try { // 按消费组、topic构建订阅信息=》 ms = FilterAPI.buildSubscriptionData(this.groupName(), t, SubscriptionData.SUB_ALL); } catch (Exception e) { log.error("parse subscription error", e); } ms.setSubVersion(0L); result.add(ms); } } } return result; }
Example #29
Source File: DefaultMQPullConsumerImpl.java From rocketmq-4.3.0 with Apache License 2.0 | 6 votes |
private void copySubscription() throws MQClientException { try { // 所有注册的topic Set<String> registerTopics = this.defaultMQPullConsumer.getRegisterTopics(); if (registerTopics != null) { for (final String topic : registerTopics) { // 构建topic订阅配置=》 SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPullConsumer.getConsumerGroup(), topic, SubscriptionData.SUB_ALL); // 存储topic订阅配置=》 this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData); } } } catch (Exception e) { throw new MQClientException("subscription exception", e); } }
Example #30
Source File: DefaultMQPushConsumerImpl.java From rocketmq-read with Apache License 2.0 | 6 votes |
/** * 关注 topic。上传源代码 * @param topic ; * @param fullClassName ; * @param filterClassSource ; * @throws MQClientException ; */ public void subscribe(String topic, String fullClassName, String filterClassSource) throws MQClientException { try { SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPushConsumer.getConsumerGroup(), topic, "*"); subscriptionData.setSubString(fullClassName); subscriptionData.setClassFilterMode(true); subscriptionData.setFilterClassSource(filterClassSource); this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData); if (this.mQClientFactory != null) { this.mQClientFactory.sendHeartbeatToAllBrokerWithLock(); } } catch (Exception e) { throw new MQClientException("subscription exception", e); } }