[
https://issues.apache.org/jira/browse/ARTEMIS-5852?focusedWorklogId=1001897&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1001897
]
ASF GitHub Bot logged work on ARTEMIS-5852:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 26/Jan/26 23:52
Start Date: 26/Jan/26 23:52
Worklog Time Spent: 10m
Work Description: clebertsuconic commented on code in PR #6191:
URL: https://github.com/apache/artemis/pull/6191#discussion_r2729718151
##########
artemis-lockmanager/artemis-lockmanager-etcd/src/main/java/org/apache/activemq/artemis/lockmanager/etcd/EtcdDistributedLockManagerFactory.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * 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.lockmanager.etcd;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.apache.activemq.artemis.lockmanager.DistributedLockManager;
+import org.apache.activemq.artemis.lockmanager.DistributedLockManagerFactory;
+
+public class EtcdDistributedLockManagerFactory implements
DistributedLockManagerFactory {
+
+ @Override
+ public DistributedLockManager build(Map<String, String> config) {
+
+ EtcdLockConfiguration lockConfiguration = new EtcdLockConfiguration()
+ .setUser(config.getOrDefault(USER, DEFAULT_USER))
+ .setPassword(config.getOrDefault(PASSWORD, DEFAULT_PASSWORD))
+ .setAuthority(config.getOrDefault(AUTHORITY, DEFAULT_AUTHORITY))
+ .setLeasePeriod(Integer.parseInt(config.getOrDefault(LEASE_PERIOD,
DEFAULT_LEASE_PERIOD)))
+ .setEndpoints(config.get(CONNECT_STRING));
+
+ return new EtcdDistributedLockManager(lockConfiguration);
+ }
+
+ @Override
+ public String getName() {
+ return "etcd";
+ }
+
+ @Override
+ public String getImplName() {
+ return EtcdDistributedLockManager.class.getName();
+ }
+
+ public static String CONNECT_STRING = "connect-string";
+ public static String USER = "user";
+ public static String DEFAULT_USER = null;
+ public static String PASSWORD = "password";
+ public static String DEFAULT_PASSWORD = null;
+ public static String AUTHORITY = "authority";
+ public static String DEFAULT_AUTHORITY = null;
+ public static String LEASE_PERIOD = "lease-period";
+ public static String DEFAULT_LEASE_PERIOD = "10";
+
+ public static final Set<String> VALID_PARAMS = Stream.of(
+ USER, PASSWORD, AUTHORITY, LEASE_PERIOD).collect(Collectors.toSet());
Review Comment:
@tabish121 I just realized what you meant by Set.of...
I just moved the code from somewhere else... I guess that code was written
under old API. but I won't know for sure since it wasn't my original code
Thanks again.
Issue Time Tracking
-------------------
Worklog Id: (was: 1001897)
Time Spent: 50m (was: 40m)
> Leader/Follower pattern on acceptors
> ------------------------------------
>
> Key: ARTEMIS-5852
> URL: https://issues.apache.org/jira/browse/ARTEMIS-5852
> Project: Artemis
> Issue Type: New Feature
> Components: Broker
> Affects Versions: 2.50.0
> Reporter: Clebert Suconic
> Priority: Major
> Labels: pull-request-available
> Fix For: 2.51.0
>
> Time Spent: 50m
> Remaining Estimate: 0h
>
> This opens the possibility of using Mirroring for Failover, in replacement of
> replication.
> You set a LeaderManager on the configuration, and configure Acceptors to only
> start after a distributed lock is acquired.
> this current implementation is being done on top of DistributedLockManager,
> and I'm adding etcd as an option also.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]