diff --git a/eventhubs/spring-cloud-azure-starter-eventhubs/eventhubs-client/README.md b/eventhubs/spring-cloud-azure-starter-eventhubs/eventhubs-client/README.md index f26e8de9f..82feccfc4 100644 --- a/eventhubs/spring-cloud-azure-starter-eventhubs/eventhubs-client/README.md +++ b/eventhubs/spring-cloud-azure-starter-eventhubs/eventhubs-client/README.md @@ -102,27 +102,22 @@ It may take a few minutes to run the script. After successful running, you will ```shell -azurerm_resource_group.main: Creating... -azurerm_resource_group.main: Creation complete after 3s [id=/subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/rg-eventhubs-binder-nxatj] -azurerm_eventhub_namespace.eventhubs_namespace: Creating... -azurerm_storage_account.storage_account: Creating... -... -azurerm_storage_account.storage_account: Creation complete ... -azurerm_storage_container.storage_container: Creating... -azurerm_role_assignment.role_storage_account_contributor: Creating... -azurerm_storage_container.storage_container: Creation complete ... -azurerm_role_assignment.role_storage_blob_data_owner: Creating... +azurecaf_name.resource_group: Creating... +azurecaf_name.azurecaf_name_eventhubs: Creating... + ... -azurerm_role_assignment.role_storage_blob_data_owner: Creation complete ... -azurerm_role_assignment.role_storage_account_contributor: Creation complete ... + +azurerm_eventhub_namespace.eventhubs_namespace: Creating... +azurerm_eventhub_namespace.eventhubs_namespace: Still creating... [10s elapsed] + ... -azurerm_eventhub_namespace.eventhubs_namespace: Creation complete ... + azurerm_eventhub.eventhubs: Creating... -azurerm_eventhub.eventhubs: Creation complete ... -... -azurerm_role_assignment.role_eventhubs_data_owner: Creation complete ... +azurerm_role_assignment.role_eventhubs_data_owner: Creating... +azurerm_role_assignment.role_eventhubs_data_owner: Still creating... [10s elapsed] + +Apply complete! Resources: 6 added, 0 changed, 0 destroyed. -Apply complete! Resources: 8 added, 0 changed, 0 destroyed. Outputs: ... @@ -151,10 +146,7 @@ If you want to run the sample in debug mode, you can save the output value. ```shell AZURE_EVENTHUBS_NAMESPACE=... -AZURE_STORAGE_CONTAINER_NAME=... -AZURE_STORAGE_ACCOUNT_NAME=... AZURE_EVENTHUB_NAME=... -AZURE_EVENTHUB_CONSUMER_GROUP=... ``` ## Run Locally @@ -180,15 +172,10 @@ You can debug your sample by adding the saved output values to the tool's enviro 1. Verify in your app’s logs that similar messages were posted: ```shell -New message received: 'Hello world, 17' ... -Message 'Hello world, 17' successfully checkpointed -... -New message received: 'Hello world, 18' ... -Message 'Hello world, 18' successfully checkpointed -... -New message received: 'Hello world, 27' ... -Message 'Hello world, 27' successfully checkpointed - +Sending message using Event Hub producer client. +Sent message to Event Hub. +Receiving message using Event Hub consumer client. +Received message: Test event ``` ## Clean Up Resources diff --git a/eventhubs/spring-cloud-azure-starter-eventhubs/eventhubs-client/src/main/java/com/azure/spring/sample/eventhubs/client/EventHubClientApplication.java b/eventhubs/spring-cloud-azure-starter-eventhubs/eventhubs-client/src/main/java/com/azure/spring/sample/eventhubs/client/EventHubClientApplication.java index 4b672bb51..b197ce6a1 100644 --- a/eventhubs/spring-cloud-azure-starter-eventhubs/eventhubs-client/src/main/java/com/azure/spring/sample/eventhubs/client/EventHubClientApplication.java +++ b/eventhubs/spring-cloud-azure-starter-eventhubs/eventhubs-client/src/main/java/com/azure/spring/sample/eventhubs/client/EventHubClientApplication.java @@ -40,12 +40,13 @@ public static void main(String[] args) { @Override public void run(String... args) throws Exception { - LOGGER.info("Event Hub producer client created"); - producerClient.send(Arrays.asList(new EventData("Test event - graalvm"))); - LOGGER.info("Sent message to Event Hub"); + LOGGER.info("Sending message using Event Hub producer client."); + producerClient.send(Arrays.asList(new EventData("Test event"))); + LOGGER.info("Sent message to Event Hub."); producerClient.close(); TimeUnit.SECONDS.sleep(3); + LOGGER.info("Receiving message using Event Hub consumer client."); String PARTITION_ID = "0"; IterableStream partitionEvents = consumerClient.receiveFromPartition(PARTITION_ID, 1, EventPosition.earliest()); @@ -54,7 +55,7 @@ public void run(String... args) throws Exception { PartitionEvent pe = iterator.next(); LOGGER.info("Received message: {}", pe.getData().getBodyAsString()); } else { - LOGGER.warn("Failed to receive message."); + LOGGER.error("Failed to receive message."); } } } diff --git a/eventhubs/spring-cloud-azure-stream-binder-eventhubs/eventhubs-binder/src/main/java/com/azure/spring/sample/eventhubs/binder/BatchProducerAndConsumerConfiguration.java b/eventhubs/spring-cloud-azure-stream-binder-eventhubs/eventhubs-binder/src/main/java/com/azure/spring/sample/eventhubs/binder/BatchProducerAndConsumerConfiguration.java index 41c0bc28c..735569c28 100644 --- a/eventhubs/spring-cloud-azure-stream-binder-eventhubs/eventhubs-binder/src/main/java/com/azure/spring/sample/eventhubs/binder/BatchProducerAndConsumerConfiguration.java +++ b/eventhubs/spring-cloud-azure-stream-binder-eventhubs/eventhubs-binder/src/main/java/com/azure/spring/sample/eventhubs/binder/BatchProducerAndConsumerConfiguration.java @@ -20,7 +20,7 @@ @Profile("batch") public class BatchProducerAndConsumerConfiguration { - private static final Logger LOGGER = LoggerFactory.getLogger(EventHubBinderApplication.class); + private static final Logger LOGGER = LoggerFactory.getLogger(BatchProducerAndConsumerConfiguration.class); private int i = 0; diff --git a/eventhubs/spring-cloud-azure-stream-binder-eventhubs/eventhubs-binder/src/main/java/com/azure/spring/sample/eventhubs/binder/DefaultProducerAndConsumerConfiguration.java b/eventhubs/spring-cloud-azure-stream-binder-eventhubs/eventhubs-binder/src/main/java/com/azure/spring/sample/eventhubs/binder/DefaultProducerAndConsumerConfiguration.java index 6befebce8..4aa60f2eb 100644 --- a/eventhubs/spring-cloud-azure-stream-binder-eventhubs/eventhubs-binder/src/main/java/com/azure/spring/sample/eventhubs/binder/DefaultProducerAndConsumerConfiguration.java +++ b/eventhubs/spring-cloud-azure-stream-binder-eventhubs/eventhubs-binder/src/main/java/com/azure/spring/sample/eventhubs/binder/DefaultProducerAndConsumerConfiguration.java @@ -24,7 +24,7 @@ @Profile("default") public class DefaultProducerAndConsumerConfiguration { - private static final Logger LOGGER = LoggerFactory.getLogger(EventHubBinderApplication.class); + private static final Logger LOGGER = LoggerFactory.getLogger(DefaultProducerAndConsumerConfiguration.class); private int i = 0; diff --git a/eventhubs/spring-cloud-azure-stream-binder-eventhubs/eventhubs-binder/src/main/java/com/azure/spring/sample/eventhubs/binder/ManualProducerAndConsumerConfiguration.java b/eventhubs/spring-cloud-azure-stream-binder-eventhubs/eventhubs-binder/src/main/java/com/azure/spring/sample/eventhubs/binder/ManualProducerAndConsumerConfiguration.java index 95891926e..fe921dc68 100644 --- a/eventhubs/spring-cloud-azure-stream-binder-eventhubs/eventhubs-binder/src/main/java/com/azure/spring/sample/eventhubs/binder/ManualProducerAndConsumerConfiguration.java +++ b/eventhubs/spring-cloud-azure-stream-binder-eventhubs/eventhubs-binder/src/main/java/com/azure/spring/sample/eventhubs/binder/ManualProducerAndConsumerConfiguration.java @@ -24,7 +24,7 @@ @Profile("manual") public class ManualProducerAndConsumerConfiguration { - private static final Logger LOGGER = LoggerFactory.getLogger(EventHubBinderApplication.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ManualProducerAndConsumerConfiguration.class); @Bean public Sinks.Many> many() {