[ 
https://issues.apache.org/jira/browse/ARTEMIS-5852?focusedWorklogId=1001862&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1001862
 ]

ASF GitHub Bot logged work on ARTEMIS-5852:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 26/Jan/26 20:12
            Start Date: 26/Jan/26 20:12
    Worklog Time Spent: 10m 
      Work Description: clebertsuconic commented on code in PR #6191:
URL: https://github.com/apache/artemis/pull/6191#discussion_r2729091056


##########
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:
   thank you. I moved / copied from code Franz had on the LockManager, but I 
agree with you.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 1001862)
    Time Spent: 40m  (was: 0.5h)

> 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: 40m
>  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]

Reply via email to