Skip to content

Commit

Permalink
Improve log and fix readme doc mismatch issues (#762)
Browse files Browse the repository at this point in the history
  • Loading branch information
moarychan authored Dec 4, 2024
1 parent 41d72a3 commit 4dee3fc
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
...
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<PartitionEvent> partitionEvents = consumerClient.receiveFromPartition(PARTITION_ID, 1,
EventPosition.earliest());
Expand All @@ -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.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Message<String>> many() {
Expand Down

0 comments on commit 4dee3fc

Please sign in to comment.