Apache Artemis

聊聊artemis的ActiveMQMetricsPlugin

天涯浪子 提交于 2020-02-27 09:22:21
序 本文主要研究一下artemis的ActiveMQMetricsPlugin ActiveMQMetricsPlugin activemq-artemis-2.11.0/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/metrics/ActiveMQMetricsPlugin.java public interface ActiveMQMetricsPlugin extends Serializable { ActiveMQMetricsPlugin init(Map<String, String> options); MeterRegistry getRegistry(); } ActiveMQMetricsPlugin继承了Serializable,它定义了init方法以及getRegistry方法 SimpleMetricsPlugin activemq-artemis-2.11.0/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/metrics/plugins/SimpleMetricsPlugin.java public class SimpleMetricsPlugin implements

聊聊artemis的ClientProducerCreditManager

烂漫一生 提交于 2020-02-27 08:21:48
序 本文主要研究一下artemis的ClientProducerCreditManager ClientProducerCreditManager activemq-artemis-2.11.0/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientProducerCreditManager.java public interface ClientProducerCreditManager { ClientProducerCredits getCredits(SimpleString address, boolean anon, SessionContext context); void returnCredits(SimpleString address); void receiveCredits(SimpleString address, int credits); void receiveFailCredits(SimpleString address, int credits); void reset(); void close(); int creditsMapSize(); int unReferencedCreditsSize(); /** This

聊聊artemis的groupRebalance

点点圈 提交于 2020-02-27 07:01:16
序 本文主要研究一下artemis的groupRebalance groupRebalance activemq-artemis-2.11.0/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java public class QueueImpl extends CriticalComponentImpl implements Queue { //...... private volatile boolean groupRebalance; private volatile int groupBuckets; private MessageGroups<Consumer> groups; //...... public void addConsumer(final Consumer consumer) throws Exception { if (logger.isDebugEnabled()) { logger.debug(this + " adding consumer " + consumer); } enterCritical(CRITICAL_CONSUMER); try { synchronized (this) { if (maxConsumers

聊聊artemis的FederationManager

会有一股神秘感。 提交于 2020-02-27 06:42:23
序 本文主要研究一下artemis的FederationManager FederationManager activemq-artemis-2.11.0/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/federation/FederationManager.java public class FederationManager implements ActiveMQComponent { private final ActiveMQServer server; private Map<String, Federation> federations = new HashMap<>(); private State state; enum State { STOPPED, STOPPING, /** * Deployed means {@link FederationManager#deploy()} was called but * {@link FederationManager#start()} was not called. * <p> * We need the distinction if {@link FederationManager#stop()} is called

聊聊artemis的SessionConsumerFlowCreditMessage

瘦欲@ 提交于 2020-02-27 05:52:21
序 本文主要研究一下artemis的SessionConsumerFlowCreditMessage SessionConsumerFlowCreditMessage activemq-artemis-2.11.0/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionConsumerFlowCreditMessage.java public class SessionConsumerFlowCreditMessage extends PacketImpl { private long consumerID; private int credits; public SessionConsumerFlowCreditMessage(final long consumerID, final int credits) { super(SESS_FLOWTOKEN); this.consumerID = consumerID; this.credits = credits; } public SessionConsumerFlowCreditMessage() { super(SESS_FLOWTOKEN); } // Public --

artemis小结

人盡茶涼 提交于 2020-02-27 05:50:04
序 本文主要小结一下artemis的一些知识点 artemis知识点 消息模型 它实现了mqtt、aqmp、stomp协议,jms的api,还提供了rest的api;其模型跟aqmp很像,用address、queue来抽象,其Routing Types有Anycast( point-to-point )、Multicast( publish-subscribe )两种类型 client、server端的flow control 通过credit以及windowSize来控制 client、server端的rebalance client端有ConnectionLoadBalancingPolicy,server端有MessageLoadBalancingType、Redistributor client、server端的interceptor 内置了client、server的interceptor,方便拦截添加边缘逻辑 投递模式:at-most-once、at-least-once、exactly-once exactly-once需要事务支持,不过可以通过服务端去重 消费模型:推、拉、还是推拉结合、ack模式 推拉结合的,同步receive方式就是拉的方式,消费者主动去消息服务器取消息,异步的listener方式为推的方式 特性消息:延迟消息、优先级消息、持久消息、TTL消息

聊聊artemis的scheduledDeliveryTime

与世无争的帅哥 提交于 2020-02-27 05:46:13
序 本文主要研究一下artemis的scheduledDeliveryTime HDR_SCHEDULED_DELIVERY_TIME activemq-artemis-2.11.0/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java public class CoreMessage extends RefCountMessage implements ICoreMessage { //...... @Override public Long getScheduledDeliveryTime() { Object property = getProperties().getProperty(Message.HDR_SCHEDULED_DELIVERY_TIME); if (property != null && property instanceof Number) { return ((Number) property).longValue(); } return 0L; } @Override public CoreMessage setScheduledDeliveryTime(Long time) { if (time == null

聊聊artemis的SlowConsumerReaperRunnable

烂漫一生 提交于 2020-02-27 04:54:34
序 本文主要研究一下artemis的SlowConsumerReaperRunnable SlowConsumerPolicy activemq-artemis-2.11.0/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/SlowConsumerPolicy.java public enum SlowConsumerPolicy { KILL, NOTIFY; public static SlowConsumerPolicy getType(int type) { switch (type) { case 0: return KILL; case 1: return NOTIFY; default: return null; } } } SlowConsumerPolicy定义了KILL、NOTIFY两个枚举值 SlowConsumerReaperRunnable activemq-artemis-2.11.0/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java private final class SlowConsumerReaperRunnable

聊聊artemis的BaseInterceptor

徘徊边缘 提交于 2020-02-27 04:52:37
序 本文主要研究一下artemis的BaseInterceptor BaseInterceptor activemq-artemis-master/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/BaseInterceptor.java public interface BaseInterceptor<P> { /** * Intercepts a packet which is received before it is sent to the channel * * @param packet the packet being received * @param connection the connection the packet was received on * @return {@code true} to process the next interceptor and handle the packet, * {@code false} to abort processing of the packet * @throws ActiveMQException */ boolean intercept(P packet, RemotingConnection

聊聊artemis的SessionProducerCreditsMessage

狂风中的少年 提交于 2020-02-27 04:46:40
序 本文主要研究一下artemis的SessionProducerCreditsMessage SessionProducerCreditsMessage activemq-artemis-2.11.0/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionProducerCreditsMessage.java public class SessionProducerCreditsMessage extends PacketImpl { private int credits; private SimpleString address; public SessionProducerCreditsMessage(final int credits, final SimpleString address) { super(SESS_PRODUCER_CREDITS); this.credits = credits; this.address = address; } public SessionProducerCreditsMessage() { super(SESS_PRODUCER_CREDITS); } public int