Skip to content

Commit 4dee3fc

Browse files
authored
Improve log and fix readme doc mismatch issues (#762)
1 parent 41d72a3 commit 4dee3fc

File tree

5 files changed

+24
-36
lines changed

5 files changed

+24
-36
lines changed

eventhubs/spring-cloud-azure-starter-eventhubs/eventhubs-client/README.md

+16-29
Original file line numberDiff line numberDiff line change
@@ -102,27 +102,22 @@ It may take a few minutes to run the script. After successful running, you will
102102
```shell
103103

104104

105-
azurerm_resource_group.main: Creating...
106-
azurerm_resource_group.main: Creation complete after 3s [id=/subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/rg-eventhubs-binder-nxatj]
107-
azurerm_eventhub_namespace.eventhubs_namespace: Creating...
108-
azurerm_storage_account.storage_account: Creating...
109-
...
110-
azurerm_storage_account.storage_account: Creation complete ...
111-
azurerm_storage_container.storage_container: Creating...
112-
azurerm_role_assignment.role_storage_account_contributor: Creating...
113-
azurerm_storage_container.storage_container: Creation complete ...
114-
azurerm_role_assignment.role_storage_blob_data_owner: Creating...
105+
azurecaf_name.resource_group: Creating...
106+
azurecaf_name.azurecaf_name_eventhubs: Creating...
107+
115108
...
116-
azurerm_role_assignment.role_storage_blob_data_owner: Creation complete ...
117-
azurerm_role_assignment.role_storage_account_contributor: Creation complete ...
109+
110+
azurerm_eventhub_namespace.eventhubs_namespace: Creating...
111+
azurerm_eventhub_namespace.eventhubs_namespace: Still creating... [10s elapsed]
112+
118113
...
119-
azurerm_eventhub_namespace.eventhubs_namespace: Creation complete ...
114+
120115
azurerm_eventhub.eventhubs: Creating...
121-
azurerm_eventhub.eventhubs: Creation complete ...
122-
...
123-
azurerm_role_assignment.role_eventhubs_data_owner: Creation complete ...
116+
azurerm_role_assignment.role_eventhubs_data_owner: Creating...
117+
azurerm_role_assignment.role_eventhubs_data_owner: Still creating... [10s elapsed]
118+
119+
Apply complete! Resources: 6 added, 0 changed, 0 destroyed.
124120

125-
Apply complete! Resources: 8 added, 0 changed, 0 destroyed.
126121

127122
Outputs:
128123
...
@@ -151,10 +146,7 @@ If you want to run the sample in debug mode, you can save the output value.
151146

152147
```shell
153148
AZURE_EVENTHUBS_NAMESPACE=...
154-
AZURE_STORAGE_CONTAINER_NAME=...
155-
AZURE_STORAGE_ACCOUNT_NAME=...
156149
AZURE_EVENTHUB_NAME=...
157-
AZURE_EVENTHUB_CONSUMER_GROUP=...
158150
```
159151

160152
## Run Locally
@@ -180,15 +172,10 @@ You can debug your sample by adding the saved output values to the tool's enviro
180172
1. Verify in your app’s logs that similar messages were posted:
181173

182174
```shell
183-
New message received: 'Hello world, 17' ...
184-
Message 'Hello world, 17' successfully checkpointed
185-
...
186-
New message received: 'Hello world, 18' ...
187-
Message 'Hello world, 18' successfully checkpointed
188-
...
189-
New message received: 'Hello world, 27' ...
190-
Message 'Hello world, 27' successfully checkpointed
191-
175+
Sending message using Event Hub producer client.
176+
Sent message to Event Hub.
177+
Receiving message using Event Hub consumer client.
178+
Received message: Test event
192179
```
193180

194181
## Clean Up Resources

eventhubs/spring-cloud-azure-starter-eventhubs/eventhubs-client/src/main/java/com/azure/spring/sample/eventhubs/client/EventHubClientApplication.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@ public static void main(String[] args) {
4040

4141
@Override
4242
public void run(String... args) throws Exception {
43-
LOGGER.info("Event Hub producer client created");
44-
producerClient.send(Arrays.asList(new EventData("Test event - graalvm")));
45-
LOGGER.info("Sent message to Event Hub");
43+
LOGGER.info("Sending message using Event Hub producer client.");
44+
producerClient.send(Arrays.asList(new EventData("Test event")));
45+
LOGGER.info("Sent message to Event Hub.");
4646
producerClient.close();
4747

4848
TimeUnit.SECONDS.sleep(3);
49+
LOGGER.info("Receiving message using Event Hub consumer client.");
4950
String PARTITION_ID = "0";
5051
IterableStream<PartitionEvent> partitionEvents = consumerClient.receiveFromPartition(PARTITION_ID, 1,
5152
EventPosition.earliest());
@@ -54,7 +55,7 @@ public void run(String... args) throws Exception {
5455
PartitionEvent pe = iterator.next();
5556
LOGGER.info("Received message: {}", pe.getData().getBodyAsString());
5657
} else {
57-
LOGGER.warn("Failed to receive message.");
58+
LOGGER.error("Failed to receive message.");
5859
}
5960
}
6061
}

eventhubs/spring-cloud-azure-stream-binder-eventhubs/eventhubs-binder/src/main/java/com/azure/spring/sample/eventhubs/binder/BatchProducerAndConsumerConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
@Profile("batch")
2121
public class BatchProducerAndConsumerConfiguration {
2222

23-
private static final Logger LOGGER = LoggerFactory.getLogger(EventHubBinderApplication.class);
23+
private static final Logger LOGGER = LoggerFactory.getLogger(BatchProducerAndConsumerConfiguration.class);
2424

2525
private int i = 0;
2626

eventhubs/spring-cloud-azure-stream-binder-eventhubs/eventhubs-binder/src/main/java/com/azure/spring/sample/eventhubs/binder/DefaultProducerAndConsumerConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
@Profile("default")
2525
public class DefaultProducerAndConsumerConfiguration {
2626

27-
private static final Logger LOGGER = LoggerFactory.getLogger(EventHubBinderApplication.class);
27+
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultProducerAndConsumerConfiguration.class);
2828

2929
private int i = 0;
3030

eventhubs/spring-cloud-azure-stream-binder-eventhubs/eventhubs-binder/src/main/java/com/azure/spring/sample/eventhubs/binder/ManualProducerAndConsumerConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
@Profile("manual")
2525
public class ManualProducerAndConsumerConfiguration {
2626

27-
private static final Logger LOGGER = LoggerFactory.getLogger(EventHubBinderApplication.class);
27+
private static final Logger LOGGER = LoggerFactory.getLogger(ManualProducerAndConsumerConfiguration.class);
2828

2929
@Bean
3030
public Sinks.Many<Message<String>> many() {

0 commit comments

Comments
 (0)