Skip to content
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

Improve log and fix readme doc mismatch issues #762

Merged
merged 2 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,7 @@ 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

Received message: Test event
moarychan marked this conversation as resolved.
Show resolved Hide resolved
```

## 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("Receive 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
Loading