arunsrajan commented on code in PR #26010:
URL: https://github.com/apache/camel/pull/26010#discussion_r3913349339
##########
components/camel-alibaba/camel-alibaba-eventbridge/src/main/java/org/apache/camel/component/alibaba/eventbridge/AlibabaEventBridgeUtils.java:
##########
@@ -62,117 +74,346 @@ public static EventBridgeClient
createClient(AlibabaEventBridgeEndpoint endpoint
}
public static ClientConfigurations
createClientConfigurations(AlibabaEventBridgeEndpoint endpoint, Exchange
exchange) {
- ClientConfigurations configuration = new ClientConfigurations();
- configuration.setOperation(
- OpenApiClientSupport.resolveString(exchange,
AlibabaEventBridgeProperties.OPERATION, endpoint.getOperation()));
- configuration.setEventBusName(
- OpenApiClientSupport.resolveString(exchange,
AlibabaEventBridgeProperties.EVENT_BUS_NAME,
- endpoint.getEventBusName()));
- configuration.setEventSource(
+ String defaultBusName = OpenApiClientSupport.resolveString(
+ exchange, AlibabaEventBridgeProperties.EVENT_BUS_NAME,
endpoint.getEventBusName());
+
+ return new ClientConfigurations(
+ OpenApiClientSupport.resolveString(exchange,
AlibabaEventBridgeProperties.OPERATION, endpoint.getOperation()),
+ defaultBusName,
OpenApiClientSupport.resolveString(exchange,
AlibabaEventBridgeProperties.EVENT_SOURCE,
- endpoint.getEventSource()));
- configuration.setEventType(
- OpenApiClientSupport.resolveString(exchange,
AlibabaEventBridgeProperties.EVENT_TYPE, endpoint.getEventType()));
- configuration.setEventSubject(
+ endpoint.getEventSource()),
+ OpenApiClientSupport.resolveString(exchange,
AlibabaEventBridgeProperties.EVENT_TYPE, endpoint.getEventType()),
OpenApiClientSupport.resolveString(exchange,
AlibabaEventBridgeProperties.EVENT_SUBJECT,
- endpoint.getEventSubject()));
- return configuration;
+ endpoint.getEventSubject()),
+ OpenApiClientSupport.resolveBoolean(exchange,
AlibabaEventBridgeProperties.VALIDATE_EVENT_SOURCE,
+ endpoint.isValidateEventSource()),
+ OpenApiClientSupport.resolveBoolean(exchange,
AlibabaEventBridgeProperties.VALIDATE_EVENT_TYPE,
+ endpoint.isValidateEventType()),
+ OpenApiClientSupport.resolveBoolean(exchange,
AlibabaEventBridgeProperties.VALIDATE_EVENT_SPEC,
+ endpoint.isValidateEventSpec()),
+ resolveAllowedEventBuses(exchange,
AlibabaEventBridgeProperties.ALLOWED_EVENT_SOURCES,
+ endpoint.getAllowedEventSources(), defaultBusName),
+ OpenApiClientSupport.resolveLong(exchange,
AlibabaEventBridgeProperties.EVENT_SOURCE_CACHE_TTL,
Review Comment:
Fixed. `EventSourceCache` now accepts the dynamic effective TTL from
`ClientConfigurations.eventSourceCacheTtl()` during cache validation and
lookups (`validateAndUpdateCache`, `isKnownEventBus`, `isKnownEventSource`, and
`isKnownEventType`).
Cache entries calculate their expiration using `System.currentTimeMillis() +
effectiveTtlMillis`, allowing per-exchange dynamic TTL overrides via the
`CamelAlibabaEventBridgeEventSourceCacheTtl` header.
Verified with unit test `testPerMessageCacheTtlHeaderOverride`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]