Skip to content

Conversation

@pavel-jares-bcm
Copy link
Contributor

@pavel-jares-bcm pavel-jares-bcm commented Nov 14, 2025

Description

This PR is based on #4341. It is moving the original code from Eureka to the custom APIML initialization.

The part about sync with peers is commented out, because it prolong start-up and makes a little bit different behaviour.

The original implementation was base on initialization in EurekaBootStrap. This initialization set the peerEurekaNodes.

Once we replace the original bean we also replaced its initialization. This code does not call EurekaServerContextHolder.initialize(serverContext); (responsible for setting this value).

public ApimlInstanceRegistry getApimlInstanceRegistry(
EurekaServerConfig serverConfig,
EurekaClientConfig clientConfig,
ServerCodecs serverCodecs,
EurekaClient eurekaClient,
EurekaServerHttpClientFactory eurekaServerHttpClientFactory,
InstanceRegistryProperties instanceRegistryProperties,
ApplicationContext appCntx) {
eurekaClient.getApplications(); // force initialization
return new ApimlInstanceRegistry(serverConfig, clientConfig, serverCodecs, eurekaClient, eurekaServerHttpClientFactory, instanceRegistryProperties, appCntx, new Tuple(tuple));
}
@Bean
@Primary
public PeerEurekaNodes peerEurekaNodes(
PeerAwareInstanceRegistry registry, ServerCodecs serverCodecs,
Collection<ClientRequestFilter> replicationClientAdditionalFilters,
ApplicationInfoManager applicationInfoManager, EurekaServerConfig eurekaServerConfig,
EurekaClientConfig eurekaClientConfig, @Qualifier("secureSslContext") SSLContext secureSslContext
) {
return new RefreshablePeerEurekaNodes(registry, eurekaServerConfig,
eurekaClientConfig, serverCodecs, applicationInfoManager,
replicationClientAdditionalFilters, secureSslContext, maxPeerRetries);
}

Linked to #4341

Type of change

  • fix: Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the style guidelines of this project
  • PR title conforms to commit message guideline ## Commit Message Structure Guideline
  • I have commented my code, particularly in hard-to-understand areas. In JS I did provide JSDoc
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • The java tests in the area I was working on leverage @nested annotations
  • Any dependent changes have been merged and published in downstream modules

Signed-off-by: Pavel Jareš <[email protected]>
Signed-off-by: Pavel Jareš <[email protected]>
Comment on lines +95 to +97
// Copy registry from neighboring eureka node
//int registryCount = apimlInstanceRegistry.syncUp();
//apimlInstanceRegistry.openForTraffic(applicationInfoManager, registryCount);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I was thinking about it a lot (therefor I decided to leave it there as a comment). These lines make blocking call between the Discovery services. Basically, it is waiting till the mirror is copied. I have tested on my local machine and it prolong start-up for a minute. The problem is that we don't control DVIPA and the client can call APIML only based on the state the port is listening. It would be great (at least for Modulith) if we enable port after this it could be reasonable. For now I prefer to use the same behaviour (read the peer asynchronously).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

3 participants