-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
:fix: make events group id configurable by event type
Signed-off-by: riccardomodanese <[email protected]>
- Loading branch information
1 parent
e4837dc
commit 916e4f1
Showing
24 changed files
with
462 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
commons/src/main/java/org/eclipse/kapua/commons/ContainerIdResolver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Eurotech and/or its affiliates and others | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Eurotech - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.kapua.commons; | ||
|
||
/** | ||
* Resolves the container id | ||
*/ | ||
public interface ContainerIdResolver { | ||
|
||
String getContainerId(); | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
commons/src/main/java/org/eclipse/kapua/commons/DefaultContainerIdResolver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2017, 2024 Eurotech and/or its affiliates and others | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Eurotech - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.kapua.commons; | ||
|
||
import com.google.inject.Inject; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.eclipse.kapua.KapuaErrorCodes; | ||
import org.eclipse.kapua.KapuaException; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* Lookup from the configuration file | ||
* | ||
* @since 1.0 | ||
*/ | ||
public class DefaultContainerIdResolver implements ContainerIdResolver { | ||
|
||
protected static final Logger logger = LoggerFactory.getLogger(DefaultContainerIdResolver.class); | ||
|
||
private static final String CANNOT_FIND_IP_ERROR_MSG = "Cannot resolve the container id. Please check the configuration!"; | ||
private final String containerId; | ||
|
||
@Inject | ||
public DefaultContainerIdResolver(String containerId) throws KapuaException { | ||
this.containerId = containerId; | ||
logger.info("Loaded container id: {}", this.containerId); | ||
if (StringUtils.isEmpty(this.containerId)) { | ||
throw new KapuaException(KapuaErrorCodes.INTERNAL_ERROR, CANNOT_FIND_IP_ERROR_MSG); | ||
} | ||
} | ||
|
||
@Override | ||
public String getContainerId() { | ||
return containerId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.