-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Enable event emitting for Event-Connectivity bindings #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
066b4e0 to
73caa47
Compare
markusbucher
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enables event emitting capabilities for Event-Connectivity (single-tenant) bindings in the Event Hub messaging service. Previously, only multi-tenant bindings supported emitting events.
Key changes:
- Removed the restriction that prevented single-tenant bindings from emitting events
- Added support for constructing CloudEvent sources using
systemIdfor single-tenant bindings - Added new error statuses for missing
ceSourceandsystemIdin bindings
Reviewed changes
Copilot reviewed 9 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pom.xml | Updated version from 4.0.2-SNAPSHOT to 4.0.2 for release |
| cds-feature-event-hub/src/test/resources/bindings-st.json | Added test resource for single-tenant Event-Connectivity binding |
| cds-feature-event-hub/src/test/resources/bindings-mt.json | Added test resource for multi-tenant Event Hub binding |
| cds-feature-event-hub/src/test/java/com/sap/cds/feature/messaging/eventhub/utils/EventHubBindingUtilsTest.java | Enhanced tests to verify both multi-tenant and single-tenant bindings |
| cds-feature-event-hub/src/test/java/com/sap/cds/feature/messaging/eventhub/service/EventHubMessagingServiceTest.java | Removed test that enforced single-tenant emit restriction |
| cds-feature-event-hub/src/test/java/com/sap/cds/feature/messaging/eventhub/service/EventHubMessagingServiceConfigurationTest.java | Code formatting improvements |
| cds-feature-event-hub/src/main/java/com/sap/cds/feature/messaging/eventhub/utils/EventHubErrorStatuses.java | Replaced generic single-tenant error with specific errors for missing ceSource and systemId |
| cds-feature-event-hub/src/main/java/com/sap/cds/feature/messaging/eventhub/utils/EventHubBindingUtils.java | Added bindingHasEndpoints() method to check if binding has endpoint configuration |
| cds-feature-event-hub/src/main/java/com/sap/cds/feature/messaging/eventhub/service/EventHubMessagingServiceConfiguration.java | Refactored configuration logic and added debug logging |
| cds-feature-event-hub/src/main/java/com/sap/cds/feature/messaging/eventhub/service/EventHubMessagingService.java | Implemented single-tenant emit support with systemId-based source construction |
| cds-feature-event-hub/src/main/java/com/sap/cds/feature/messaging/eventhub/client/EventHubClient.java | Code formatting improvements |
| cds-feature-event-hub/src/main/java/com/sap/cds/feature/messaging/eventhub/adapter/EventHubWebhookAdapter.java | Code formatting improvements |
| .gitignore | Added VS Code specific files to ignore list |
Comments suppressed due to low confidence (1)
cds-feature-event-hub/src/test/java/com/sap/cds/feature/messaging/eventhub/service/EventHubMessagingServiceTest.java:47
- Missing test coverage: A test was removed that verified single-tenant emit behavior (
testEmit_SingleTenantNotSupported). Since this PR enables emitting for Event-Connectivity (single-tenant) bindings, there should be a test case that verifies successful emit operations with single-tenant bindings, especially testing that the CloudEvent source is correctly constructed usingceSource + systemId.
class EventHubMessagingServiceTest {
@Test
void testEmit_TenantNotSupported() {
CdsProperties properties = new CdsProperties();
CdsProperties.Messaging.MessagingServiceConfig config = new CdsProperties.Messaging.MessagingServiceConfig("cfg");
config.setBinding("eb-mt-tests-eb");
config.getOutbox().setEnabled(false);
properties.getMessaging().getServices().put(config.getName(), config);
CdsRuntimeConfigurer configurer = CdsRuntimeConfigurer.create(new SimplePropertiesProvider(properties));
configurer.environmentConfigurations();
configurer.serviceConfigurations();
configurer.eventHandlerConfigurations();
CdsRuntime runtime = configurer.complete();
ContextualizedServiceException e = Assertions.assertThrows(ContextualizedServiceException.class, () -> emitMessage(runtime));
assertEquals(EventHubErrorStatuses.EVENT_HUB_TENANT_CONTEXT_MISSING, e.getErrorStatus());
}
private void emitMessage(CdsRuntime runtime) {
EventHubMessagingService svc = runtime.getServiceCatalog().getServices(EventHubMessagingService.class).findFirst().get();
Map<String, Object> data = new HashMap<>();
data.put("msg", "my msg 1");
Map<String, Object> headers = new HashMap<>();
headers.put("msg_header", "my header 1");
svc.emit("sap.cdscpoc.myobject.myoperation.v1", data, headers);
}
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.