Skip to content

Instantly share code, notes, and snippets.

View TharindaW's full-sized avatar
🎯
Focusing

Tharinda Wickramaarachchi TharindaW

🎯
Focusing
View GitHub Profile
@TharindaW
TharindaW / AppHubFeature.java
Last active September 10, 2023 18:28
ApplicationContextRunnerTesting
public enum AppHubFeature {
LOGISTIC_UNIT_UPDATE("Logistic Unit Update", FeatureConfig.LOGISTIC_UNIT_UPDATE),
ORDER_STATUS_UPDATE("Order Status Update", FeatureConfig.ORDER_STATUS_UPDATE),
STOCK_ADJUSTMENT("Stock Adjustment", FeatureConfig.STOCK_ADJUSTMENT);
public static class FeatureConfig {
public static final String LOGISTIC_UNIT_UPDATE = "app-hub.feature.logistic-unit-update";
public static final String ORDER_STATUS_UPDATE = "app-hub.feature.order-line-status-update";
public static final String STOCK_ADJUSTMENT = "app-hub.feature.stock-adjustment";
@TharindaW
TharindaW / HubMetricsConfiguration.java
Last active September 1, 2021 06:56
ApplicationMonitoring
@Configuration
@EnableConfigurationProperties(CommonTags.class)
public class HubMetricsConfiguration {
@Bean
public MeterRegistryCustomizer<MeterRegistry> meterRegistryCustomizer( CommonTags tags ) {
return registry -> registry.config()
.commonTags("applicationInstance", tags.getInstanceId(),
"applicationName", tags.getApplicationName(),
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Configuration packages="logging.log4j.custom.plugins" name="SOME NAME">
<Appenders>
<Console name="CONSOLE" target="SYSTEM_OUT">
<PatternLayout pattern="%d{MM-dd-yyyy HH:mm:ss,SSS} [%t] %custLayConv %msg%n"/>
</Console>
<RollingRandomAccessFile name="example" fileName="${sys:tbx.log.path}example.log" filePattern="${sys:tbx.log.path}example.log.%i" append="true" immediateFlush="true" bufferSize="262144">
<NewCustLayout pattern="%d{MM-dd-yyyy HH:mm:ss,SSS} - %msg%n"/>
<Policies>
@Plugin(name = "NewCustLayout", category = Node.CATEGORY, elementType = Layout.ELEMENT_TYPE, printObject = true)
public class NewCustLayout extends AbstractStringLayout
{
protected NewCustLayout( Charset charset )
{
super( charset );
}
@Override public String toSerializable( LogEvent event )
{