Replies: 4 comments 9 replies
-
@geoand plz assist. |
Beta Was this translation helpful? Give feedback.
-
You cannot. What exactly are you trying to achieve? |
Beta Was this translation helpful? Give feedback.
-
I was reviewing the MongoClientProcessor, where the MongoDB client name is fetched based on the MongoClientName annotation. After retrieving the client names, they are used in the generateClientBeans() method to create Mongo clients. We aim to make this configuration-based, allowing us to define all tenants in the configuration file. This way, the Mongo client can be created for specific tenants, and by modifying the BeanUtils, it would automatically switch between Mongo clients based on the tenantId. (So that we could achieve multi-tenancy based on X-TENANT-ID receiving in request header) @BuildStep
public void mongoClientNames(CombinedIndexBuildItem indexBuildItem,
BuildProducer<MongoClientNameBuildItem> mongoClientName) {
Set<String> values = new HashSet<>();
IndexView indexView = indexBuildItem.getIndex();
addMongoClientNameValues(MONGO_CLIENT_ANNOTATION, indexView, values);
for (String value : values) {
mongoClientName.produce(new MongoClientNameBuildItem(value));
}
} Want to update it something like @BuildStep
public void mongoClientNames(CombinedIndexBuildItem indexBuildItem,
BuildProducer<MongoClientNameBuildItem> mongoClientName) {
Set<String> values = new HashSet<>();
//IndexView indexView = indexBuildItem.getIndex();
//addMongoClientNameValues(MONGO_CLIENT_ANNOTATION, indexView, values);
Optional<List<String>> optionalList = ConfigProvider.getConfig().getOptionalValues("quarkus.mongodb.supportedTenant",String.class);
if(optionalList.isPresent() && !optionalList.get().isEmpty()){
optionalList.get().forEach(supportedTenant -> values.add(supportedTenant));
}
for (String value : values) {
mongoClientName.produce(new MongoClientNameBuildItem(value));
}
} |
Beta Was this translation helpful? Give feedback.
-
Thank you for your reply. It would be great if the second option is implemented, as it would simplify development for those looking to override or enhance specific functionality, making the framework more flexible. Currently, it’s a bit complex to override certain functionalities. |
Beta Was this translation helpful? Give feedback.
-
Hi Team,
Can we override a @buildstep method from an extension within our custom Quarkus extension? If so, what is the best approach to do this, and is it advisable ?
Beta Was this translation helpful? Give feedback.
All reactions