Skip to content

Instantly share code, notes, and snippets.

View sterlp's full-sized avatar

Paul Sterl sterlp

View GitHub Profile
@sterlp
sterlp / AzureServiceBusListener.java
Last active May 16, 2024 11:34
Read topic message from an Azure ServiceBus
@Test
void testServiceBusReceiverClient() throws Exception {
String connectionString = "xxxx";
String topicName = "xxxxx";
String subName = "xxxx";
final ServiceBusReceiverClient client = new ServiceBusClientBuilder()
.connectionString(connectionString)
.receiver()
.topicName(topicName)
@sterlp
sterlp / HealthTemplate.java
Last active February 27, 2024 12:22
Spring Boot HealthTemplate for Spring Actuator
public class HealthTemplate<T> implements HealthIndicator {
private final boolean resultAsValue;
private final Health.Builder health = Health.unknown();
private final AtomicInteger numberOfExecutions = new AtomicInteger(0);
private final AtomicInteger numberOfErrors = new AtomicInteger(0);
private final AtomicLong callDuration = new AtomicLong(0L);
public HealthTemplate() {
resultAsValue = false;
}
@sterlp
sterlp / Angular UI pom.xml
Last active May 16, 2024 11:14
Angular Integration into maven build, CLEAN, INSTALL, TEST
<build>
<sourceDirectory>src/app</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
</resource>
<resource>
<directory>e2e</directory>
</resource>
</resources>
@sterlp
sterlp / HystrixConfig.java
Last active May 30, 2021 10:12
List spring boot configuration and configure Hystrix using application.properties instead of config.properties
@Configuration
public class HystrixConfig {
@Autowired
private Environment env;
@EventListener({
ContextRefreshedEvent.class, // on spring start
EnvironmentChangeEvent.class // on configuration changes, requires spring-cloud
}
@sterlp
sterlp / HystrixConfig.java
Created May 29, 2021 14:02
Add Netflix Hystrix and hystrix.stream endpoint to Spring Boot 2.4.x
@Configuration
public class HystrixConfig {
@Bean
public ServletRegistrationBean<HystrixMetricsStreamServlet> hystrixStreamServlet(){
return new ServletRegistrationBean<>(new HystrixMetricsStreamServlet(), "/hystrix.stream");
}
}