@Bean public PropertyPathEndpoint propertyPathEndpoint(BusProperties busProperties) { return new PropertyPathEndpoint(new CompositePropertyPathNotificationExtractor(this.extractors), busProperties.getId()); }
@StreamListener(SpringCloudBusClient.INPUT) public void acceptRemote(RemoteApplicationEvent event) { if (event instanceof AckRemoteApplicationEvent) { if (this.bus.getTrace().isEnabled() && !this.serviceMatcher.isFromSelf(event) && this.applicationEventPublisher != null) { this.applicationEventPublisher.publishEvent(event); this.applicationEventPublisher.publishEvent(event); if (this.bus.getAck().isEnabled()) { AckRemoteApplicationEvent ack = new AckRemoteApplicationEvent(this, this.serviceMatcher.getServiceId(), this.bus.getAck().getDestinationService(), event.getDestinationService(), event.getId(), event.getClass()); this.cloudBusOutboundChannel if (this.bus.getTrace().isEnabled() && this.applicationEventPublisher != null) {
@PostConstruct public void init() { BindingProperties inputBinding = this.bindings.getBindings() .get(SpringCloudBusClient.INPUT); if (inputBinding == null) { this.bindings.getBindings().put(SpringCloudBusClient.INPUT, new BindingProperties()); } BindingProperties input = this.bindings.getBindings() .get(SpringCloudBusClient.INPUT); if (input.getDestination() == null || input.getDestination().equals(SpringCloudBusClient.INPUT)) { input.setDestination(this.bus.getDestination()); } BindingProperties outputBinding = this.bindings.getBindings() .get(SpringCloudBusClient.OUTPUT); if (outputBinding == null) { this.bindings.getBindings().put(SpringCloudBusClient.OUTPUT, new BindingProperties()); } BindingProperties output = this.bindings.getBindings() .get(SpringCloudBusClient.OUTPUT); if (output.getDestination() == null || output.getDestination().equals(SpringCloudBusClient.OUTPUT)) { output.setDestination(this.bus.getDestination()); } }
@StreamListener(SpringCloudBusClient.INPUT) public void acceptRemote(RemoteApplicationEvent event) { if (event instanceof AckRemoteApplicationEvent) { if (this.bus.getTrace().isEnabled() && !this.serviceMatcher.isFromSelf(event) && this.applicationEventPublisher != null) { this.applicationEventPublisher.publishEvent(event); this.applicationEventPublisher.publishEvent(event); if (this.bus.getAck().isEnabled()) { AckRemoteApplicationEvent ack = new AckRemoteApplicationEvent(this, this.serviceMatcher.getServiceId(), this.bus.getAck().getDestinationService(), event.getDestinationService(), event.getId(), event.getClass()); this.cloudBusOutboundChannel if (this.bus.getTrace().isEnabled() && this.applicationEventPublisher != null) {
@PostConstruct public void init() { BindingProperties inputBinding = this.bindings.getBindings() .get(SpringCloudBusClient.INPUT); if (inputBinding == null) { this.bindings.getBindings().put(SpringCloudBusClient.INPUT, new BindingProperties()); } BindingProperties input = this.bindings.getBindings() .get(SpringCloudBusClient.INPUT); if (input.getDestination() == null || input.getDestination().equals(SpringCloudBusClient.INPUT)) { input.setDestination(this.bus.getDestination()); } BindingProperties outputBinding = this.bindings.getBindings() .get(SpringCloudBusClient.OUTPUT); if (outputBinding == null) { this.bindings.getBindings().put(SpringCloudBusClient.OUTPUT, new BindingProperties()); } BindingProperties output = this.bindings.getBindings() .get(SpringCloudBusClient.OUTPUT); if (output.getDestination() == null || output.getDestination().equals(SpringCloudBusClient.OUTPUT)) { output.setDestination(this.bus.getDestination()); } }
public String getApplicationId() { return bus.getId(); }
private Void updateLastTargetQueries(final String tenant, final List<TargetPoll> polls) { LOG.debug("Persist {} targetqueries.", polls.size()); final List<List<String>> pollChunks = Lists.partition( polls.stream().map(TargetPoll::getControllerId).collect(Collectors.toList()), Constants.MAX_ENTRIES_IN_STATEMENT); pollChunks.forEach(chunk -> { setLastTargetQuery(tenant, System.currentTimeMillis(), chunk); chunk.forEach(controllerId -> afterCommit.afterCommit( () -> eventPublisher.publishEvent(new TargetPollEvent(controllerId, tenant, bus.getId())))); }); return null; }
@Bean public ServiceMatcher serviceMatcher(@BusPathMatcher PathMatcher pathMatcher, BusProperties properties, Environment environment) { String[] configNames = environment.getProperty(CLOUD_CONFIG_NAME_PROPERTY, String[].class, new String[] {}); ServiceMatcher serviceMatcher = new ServiceMatcher(pathMatcher, properties.getId(), configNames); return serviceMatcher; }
@Bean public ServiceMatcher serviceMatcher(@BusPathMatcher PathMatcher pathMatcher, BusProperties properties, Environment environment) { String[] configNames = environment.getProperty(CLOUD_CONFIG_NAME_PROPERTY, String[].class, new String[] {}); ServiceMatcher serviceMatcher = new ServiceMatcher(pathMatcher, properties.getId(), configNames); return serviceMatcher; }
@Bean @ConditionalOnEnabledEndpoint public EnvironmentBusEndpoint environmentBusEndpoint( ApplicationContext context, BusProperties bus) { return new EnvironmentBusEndpoint(context, bus.getId()); } }
@Bean @ConditionalOnEnabledEndpoint public RefreshBusEndpoint refreshBusEndpoint(ApplicationContext context, BusProperties bus) { return new RefreshBusEndpoint(context, bus.getId()); } }
@Bean @ConditionalOnEnabledEndpoint public RefreshBusEndpoint refreshBusEndpoint(ApplicationContext context, BusProperties bus) { return new RefreshBusEndpoint(context, bus.getId()); } }
private void sendRolloutGroupDeletedEvents(final JpaRollout rollout) { final List<Long> groupIds = rollout.getRolloutGroups().stream().map(RolloutGroup::getId) .collect(Collectors.toList()); afterCommit.afterCommit(() -> groupIds.forEach(rolloutGroupId -> eventPublisher .publishEvent(new RolloutGroupDeletedEvent(tenantAware.getCurrentTenant(), rolloutGroupId, JpaRolloutGroup.class.getName(), bus.getId())))); }
/** * Sends the {@link CancelTargetAssignmentEvent} for a specific target to * the eventPublisher. * * @param target * the Target which has been assigned to a distribution set * @param actionId * the action id of the assignment */ void cancelAssignDistributionSetEvent(final Target target, final Long actionId) { afterCommit.afterCommit( () -> eventPublisher.publishEvent(new CancelTargetAssignmentEvent(target, actionId, bus.getId()))); }
@Bean @ConditionalOnEnabledEndpoint public EnvironmentBusEndpoint environmentBusEndpoint( ApplicationContext context, BusProperties bus) { return new EnvironmentBusEndpoint(context, bus.getId()); } }
private void cancelAssignDistributionSetEvent(final JpaTarget target, final Long actionId) { afterCommit.afterCommit( () -> eventPublisher.publishEvent(new CancelTargetAssignmentEvent(target, actionId, bus.getId()))); } }
protected void sendTargetAssignDistributionSetEvent(final String tenant, final long distributionSetId, final List<Action> actions) { if (CollectionUtils.isEmpty(actions)) { return; } afterCommit.afterCommit(() -> eventPublisher.publishEvent(new TargetAssignDistributionSetEvent(tenant, distributionSetId, actions, bus.getId(), actions.get(0).isMaintenanceWindowAvailable()))); }
protected void sendTargetUpdatedEvent(final JpaTarget target) { afterCommit.afterCommit(() -> eventPublisher.publishEvent(new TargetUpdatedEvent(target, bus.getId()))); }
@Bean public PropertyPathEndpoint propertyPathEndpoint(BusProperties busProperties) { return new PropertyPathEndpoint(new CompositePropertyPathNotificationExtractor(this.extractors), busProperties.getId()); }
@Override @Transactional @Retryable(include = { ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY)) public void delete(final Collection<Long> targetIDs) { final List<JpaTarget> targets = targetRepository.findAllById(targetIDs); if (targets.size() < targetIDs.size()) { throw new EntityNotFoundException(Target.class, targetIDs, targets.stream().map(Target::getId).collect(Collectors.toList())); } targetRepository.deleteByIdIn(targetIDs); afterCommit.afterCommit(() -> targets.forEach(target -> eventPublisher.publishEvent( new TargetDeletedEvent(tenantAware.getCurrentTenant(), target.getId(), target.getControllerId(), Optional.ofNullable(target.getAddress()).map(URI::toString).orElse(null), JpaTarget.class.getName(), bus.getId())))); }