Java Code Examples for de.codecentric.boot.admin.server.domain.entities.Instance#getRegistration()
The following examples show how to use
de.codecentric.boot.admin.server.domain.entities.Instance#getRegistration() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QueryIndexEndpointStrategy.java From Moss with Apache License 2.0 | 6 votes |
@Override public Mono<Endpoints> detectEndpoints(Instance instance) { Registration registration = instance.getRegistration(); String managementUrl = registration.getManagementUrl(); if (managementUrl == null || Objects.equals(registration.getServiceUrl(), managementUrl)) { return Mono.empty(); } return instanceWebClient.instance(instance) .get() .uri(managementUrl) .exchange() .flatMap(response -> { if (response.statusCode().is2xxSuccessful() && response.headers() .contentType() .map(actuatorMediaType::isCompatibleWith) .orElse(false)) { return response.bodyToMono(Response.class); } else { return response.bodyToMono(Void.class).then(Mono.empty()); } }) .flatMap(this::convert); }
Example 2
Source File: InstanceNameNotificationFilterTest.java From Moss with Apache License 2.0 | 6 votes |
@Test public void test_filterByName() { NotificationFilter filter = new ApplicationNameNotificationFilter("foo", null); Instance filteredInstance = Instance.create(InstanceId.of("-")) .register(Registration.create("foo", "http://health").build()); InstanceRegisteredEvent filteredEvent = new InstanceRegisteredEvent(filteredInstance.getId(), filteredInstance.getVersion(), filteredInstance.getRegistration()); assertThat(filter.filter(filteredEvent, filteredInstance)).isTrue(); Instance ignoredInstance = Instance.create(InstanceId.of("-")) .register(Registration.create("bar", "http://health").build()); InstanceRegisteredEvent ignoredEvent = new InstanceRegisteredEvent(ignoredInstance.getId(), ignoredInstance.getVersion(), ignoredInstance.getRegistration()); assertThat(filter.filter(ignoredEvent, ignoredInstance)).isFalse(); }
Example 3
Source File: InstanceIdNotificationFilterTest.java From Moss with Apache License 2.0 | 6 votes |
@Test public void test_filterByName() { NotificationFilter filter = new InstanceIdNotificationFilter(InstanceId.of("cafebabe"), null); Instance filteredInstance = Instance.create(InstanceId.of("cafebabe")) .register(Registration.create("foo", "http://health").build()); InstanceRegisteredEvent filteredEvent = new InstanceRegisteredEvent(filteredInstance.getId(), filteredInstance.getVersion(), filteredInstance.getRegistration()); assertThat(filter.filter(filteredEvent, filteredInstance)).isTrue(); Instance ignoredInstance = Instance.create(InstanceId.of("-")) .register(Registration.create("foo", "http://health").build()); InstanceRegisteredEvent ignoredEvent = new InstanceRegisteredEvent(ignoredInstance.getId(), ignoredInstance.getVersion(), ignoredInstance.getRegistration()); assertThat(filter.filter(ignoredEvent, ignoredInstance)).isFalse(); }
Example 4
Source File: QueryIndexEndpointStrategy.java From spring-boot-admin with Apache License 2.0 | 6 votes |
@Override public Mono<Endpoints> detectEndpoints(Instance instance) { Registration registration = instance.getRegistration(); String managementUrl = registration.getManagementUrl(); if (managementUrl == null || Objects.equals(registration.getServiceUrl(), managementUrl)) { log.debug("Querying actuator-index for instance {} omitted.", instance.getId()); return Mono.empty(); } return this.instanceWebClient.instance(instance).get().uri(managementUrl).exchange() .flatMap(this.convert(instance, managementUrl)).onErrorResume((e) -> { log.warn("Querying actuator-index for instance {} on '{}' failed: {}", instance.getId(), managementUrl, e.getMessage()); log.debug("Querying actuator-index for instance {} on '{}' failed.", instance.getId(), managementUrl, e); return Mono.empty(); }); }
Example 5
Source File: InstanceNameNotificationFilterTest.java From spring-boot-admin with Apache License 2.0 | 6 votes |
@Test public void test_filterByName() { NotificationFilter filter = new ApplicationNameNotificationFilter("foo", null); Instance filteredInstance = Instance.create(InstanceId.of("-")) .register(Registration.create("foo", "http://health").build()); InstanceRegisteredEvent filteredEvent = new InstanceRegisteredEvent(filteredInstance.getId(), filteredInstance.getVersion(), filteredInstance.getRegistration()); assertThat(filter.filter(filteredEvent, filteredInstance)).isTrue(); Instance ignoredInstance = Instance.create(InstanceId.of("-")) .register(Registration.create("bar", "http://health").build()); InstanceRegisteredEvent ignoredEvent = new InstanceRegisteredEvent(ignoredInstance.getId(), ignoredInstance.getVersion(), ignoredInstance.getRegistration()); assertThat(filter.filter(ignoredEvent, ignoredInstance)).isFalse(); }
Example 6
Source File: InstanceIdNotificationFilterTest.java From spring-boot-admin with Apache License 2.0 | 6 votes |
@Test public void test_filterByName() { NotificationFilter filter = new InstanceIdNotificationFilter(InstanceId.of("cafebabe"), null); Instance filteredInstance = Instance.create(InstanceId.of("cafebabe")) .register(Registration.create("foo", "http://health").build()); InstanceRegisteredEvent filteredEvent = new InstanceRegisteredEvent(filteredInstance.getId(), filteredInstance.getVersion(), filteredInstance.getRegistration()); assertThat(filter.filter(filteredEvent, filteredInstance)).isTrue(); Instance ignoredInstance = Instance.create(InstanceId.of("-")) .register(Registration.create("foo", "http://health").build()); InstanceRegisteredEvent ignoredEvent = new InstanceRegisteredEvent(ignoredInstance.getId(), ignoredInstance.getVersion(), ignoredInstance.getRegistration()); assertThat(filter.filter(ignoredEvent, ignoredInstance)).isFalse(); }