Skip to content

Conversation

@kevin-b-sap
Copy link

No description provided.

@kevin-b-sap kevin-b-sap force-pushed the feature/event-connectivity-emit branch from 066b4e0 to 73caa47 Compare November 20, 2025 08:54
Copy link

@markusbucher markusbucher left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

Copilot AI left a 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 systemId for single-tenant bindings
  • Added new error statuses for missing ceSource and systemId in 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 using ceSource + 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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants