[
https://issues.apache.org/jira/browse/ARTEMIS-5437?focusedWorklogId=967260&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-967260
]
ASF GitHub Bot logged work on ARTEMIS-5437:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 23/Apr/25 13:48
Start Date: 23/Apr/25 13:48
Worklog Time Spent: 10m
Work Description: gemmellr commented on code in PR #5641:
URL: https://github.com/apache/activemq-artemis/pull/5641#discussion_r2056068583
##########
artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/bridge/AMQPBridgeConfiguration.java:
##########
@@ -0,0 +1,317 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.artemis.protocol.amqp.connect.bridge;
+
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.LARGE_MESSAGE_THRESHOLD;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.LINK_ATTACH_TIMEOUT;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.LINK_RECOVERY_DELAY;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.LINK_RECOVERY_INITIAL_DELAY;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.MAX_LINK_RECOVERY_ATTEMPTS;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.PRESETTLE_SEND_MODE;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.DISABLE_RECEIVER_PRIORITY;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.PULL_RECEIVER_BATCH_SIZE;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.QUEUE_RECEIVER_IDLE_TIMEOUT;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.RECEIVER_CREDITS;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.RECEIVER_CREDITS_LOW;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.RECEIVER_QUIESCE_TIMEOUT;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.IGNORE_QUEUE_FILTERS;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.ADDRESS_RECEIVER_IDLE_TIMEOUT;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.DEFAULT_ADDRESS_RECEIVER_IDLE_TIMEOUT;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.DEFAULT_CORE_MESSAGE_TUNNELING_ENABLED;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.DEFAULT_DISABLE_RECEIVER_DEMAND_TRACKING;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.DEFAULT_IGNNORE_QUEUE_CONSUMER_FILTERS;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.DEFAULT_IGNNORE_QUEUE_FILTERS;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.DEFAULT_LINK_ATTACH_TIMEOUT;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.DEFAULT_LINK_RECOVERY_DELAY;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.DEFAULT_LINK_RECOVERY_INITIAL_DELAY;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.DEFAULT_MAX_LINK_RECOVERY_ATTEMPTS;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.DEFAULT_DISABLE_RECEIVER_PRIORITY;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.DEFAULT_PULL_CREDIT_BATCH_SIZE;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.DEFAULT_QUEUE_RECEIVER_IDLE_TIMEOUT;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.DEFAULT_RECEIVER_QUIESCE_TIMEOUT;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.DEFAULT_SEND_SETTLED;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.DISABLE_RECEIVER_DEMAND_TRACKING;
+import static
org.apache.activemq.artemis.protocol.amqp.connect.bridge.AMQPBridgeConstants.IGNORE_QUEUE_CONSUMER_FILTERS;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+import org.apache.activemq.artemis.protocol.amqp.proton.AMQPConnectionContext;
+import org.apache.activemq.artemis.protocol.amqp.proton.AmqpSupport;
+
+/**
+ * A configuration class that contains API for getting AMQP bridge specific
configuration
+ * either from a {@link Map} of configuration elements or from the connection
associated
+ * with the bridge instance, or possibly from a set default value.
+ */
+public class AMQPBridgeConfiguration {
+
+ private final Map<String, Object> properties;
+ private final AMQPConnectionContext connection;
+
+ public AMQPBridgeConfiguration(AMQPConnectionContext connection,
Map<String, Object> properties) {
+ Objects.requireNonNull(connection, "Connection provided cannot be null");
+
+ this.connection = connection;
+
+ if (properties != null && !properties.isEmpty()) {
+ this.properties = new HashMap<>(properties);
+ } else {
+ this.properties = Collections.emptyMap();
+ }
+ }
+
+ /**
+ * {@return the credit batch size offered to a receiver link.}
+ */
+ public int getReceiverCredits() {
+ final Object property = properties.get(RECEIVER_CREDITS);
+ if (property instanceof Number) {
+ return ((Number) property).intValue();
+ } else if (property instanceof String) {
+ return Integer.parseInt((String) property);
+ } else {
+ return connection.getAmqpCredits();
+ }
+ }
+
+ /**
+ * {@return the number of remaining credits on a receiver before the batch
is replenished.}
Review Comment:
I'm not certain whether the processor handles the trailing '.' here inside
the tag, but as the typical usage of the new "{@return some detail} Additional
detail" tag syntax definitely omits a '.' outside the "{}" tag, I would not be
surprised if this caused it to finish up with ".." at the end of the generated
"Returns foo.." text.
EDIT: it does, so need to remove the '.' inside the tag, here and various
other places above/below.
Issue Time Tracking
-------------------
Worklog Id: (was: 967260)
Time Spent: 20m (was: 10m)
> Add a more advanced message bridging feature to AMQP broker connections
> -----------------------------------------------------------------------
>
> Key: ARTEMIS-5437
> URL: https://issues.apache.org/jira/browse/ARTEMIS-5437
> Project: ActiveMQ Artemis
> Issue Type: New Feature
> Components: AMQP
> Affects Versions: 2.40.0
> Reporter: Timothy A. Bish
> Assignee: Timothy A. Bish
> Priority: Major
> Labels: pull-request-available
> Time Spent: 20m
> Remaining Estimate: 0h
>
> The AMQP broker connection currently offers a somewhat primitive bridge
> capability by offering configuration of SENDER and RECEIVER elements which
> can perform some basic bridging primarily between Artemis instances given the
> way the send to address, receiver from queue behavior is carried over into
> the implementation.
> This new AMQP bridge feature offers a more advanced and flexible bridge
> capability that allows for messages to be bridged from or to a remote with
> various configuration options to account for the remote not being an Artemis
> peer but leveraging some Artemis capabilities like Core message tunneling
> over AMQP when the remote is an Artemis instance. By default the receivers
> for this bridge implementation activate only on local demand being present
> but can be configured to be always active as the older RECEIVER capability
> currently behaves.
> This implementation also incorporates features implemented in the AMQP
> federation bits that deal with draining link credit on receivers before
> detaching to avoid potential duplicates and idling links if demand tracking
> is active (default mode) to avoid rapid create and destroy cycles for bridge
> receiver links. There is also in-built link recovery mechanisms that will
> attempt to recreate links that are closed by the remote on a periodic basis.
> Also like federation Queue receivers the new bridge receivers can be
> configured in pull mode to only offer credit when the local Queue has no
> pending backlog to avoid moving messages until there is a need.
> A example of configuration for an AMQP broker connection bridge is shown below
> {code:xml}
> <amqp-connection uri="tcp://host:port"
> name="my-bridge-configuration">
> <bridge>
> <bridge-from-queue name="policy-name-1">
> <include address-match="#" queue-match="someQueue" />
> <property key="amqpCredits" value="0"/>
> <property key="amqpPullConsumerCredits" value="10"/>
> </bridge-from-queue>
> <bridge-to-queue name="policy-name-2">
> <include address-match="test" queue-match="myQueue" />
> </bridge-to-queue>
> <bridge-from-address name="policy-name-3">
> <include address-match="test-address" />
> <exclude address-match="all.#" />
> </bridge-from-address>
> <bridge-to-address name="policy-name-4">
> <include address-match="send-to-address" />
> <exclude address-match="all.#" />
> </bridge-to-address>
> </bridge>
> </amqp-connection>
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact