Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -13,6 +13,11 @@
<groupId>com.azure.spring</groupId>
<version>1.0.0</version> <!-- {x-version-update;com.azure.spring:azure-spring-cloud-sample-eventhubs-binder;current} -->
<name>Azure Spring Cloud Sample Event Hubs Binder</name>

<properties>
<skipSpringITs>true</skipSpringITs>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
Expand Down Expand Up @@ -80,6 +85,18 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.7.1</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-engine;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.7.1</version> <!-- {x-version-update;org.junit.vintage:junit-vintage-engine;external_dependency} -->
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down Expand Up @@ -114,6 +131,22 @@
</deployment>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-failsafe-plugin;external_dependency} -->
<executions>
<execution>
<id>default</id>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<skipITs>${skipSpringITs}</skipITs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.system.OutputCaptureRule;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;

Expand All @@ -24,7 +24,7 @@
@RunWith(SpringRunner.class)
@SpringBootTest(classes = EventHubBinderApplication.class)
@AutoConfigureMockMvc
@TestPropertySource(locations = "classpath:application-test.properties")
@ActiveProfiles("manual")
public class EventHubBinderApplicationIT {

@Rule
Expand All @@ -34,11 +34,10 @@ public class EventHubBinderApplicationIT {

@Test
public void testSendAndReceiveMessage() throws Exception {
Thread.sleep(10000);
String message = UUID.randomUUID().toString();

mvc.perform(post("/messages?message=" + message)).andExpect(status().isOk())
.andExpect(content().string(message));

String messageReceivedLog = String.format("New message received: '%s'", message);
String messageCheckpointedLog = String.format("Message '%s' successfully checkpointed", message);
boolean messageReceived = false;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
spring:
main:
banner-mode: off
cloud:
azure:
eventhub:
connection-string: ${EVENTHUB_CONNECTION_STRING_BINDER}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We could the same event hub namespace and storage account, but a different event hub and storage container.

checkpoint-storage-account: ${STORAGE_ACCOUNT_BINDER}
checkpoint-access-key: ${STORAGE_ACCOUNT_KEY_BINDER}
checkpoint-container: binder-test
stream:
function:
definition: consume;supply
bindings:
consume-in-0:
destination: binder-test

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we should think about how to name this destination

group: $Default
supply-out-0:
destination: binder-test
eventhub:
bindings:
consume-in-0:
consumer:
checkpoint-mode: MANUAL
default:
producer:
errorChannelEnabled: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"baseName": {
"defaultValue": "[resourceGroup().name]",
"type": "String"
},
"storageNamePrefix": {
"defaultValue": "[substring(uniqueString(parameters('baseName')), 0, 11)]",
"type": "string"
}
},
"functions": [],
"variables": {
"eventHubsNamespaceName": "[concat(parameters('baseName'),'-binder-eventhub')]",
"eventHubsNamespaceKeyName": "RootManageSharedAccessKey",
"storageAccountName": "[concat(substring(toLower(concat(parameters('storageNamePrefix'), uniqueString(resourceGroup().id), 'binder')), 0, 18), 'binder')]",
"location": "[resourceGroup().location]"
},
"resources": [
{
"type": "Microsoft.EventHub/namespaces",
"apiVersion": "2018-01-01-preview",
"name": "[variables('eventHubsNamespaceName')]",
"location": "[variables('location')]",
"sku": {
"name": "Standard",
"tier": "Standard",
"capacity": 1
},
"properties": {
"zoneRedundant": false,
"isAutoInflateEnabled": false,
"maximumThroughputUnits": 0,
"kafkaEnabled": true
}
},
{
"type": "Microsoft.EventHub/namespaces/AuthorizationRules",
"apiVersion": "2017-04-01",
"name": "[concat(variables('eventHubsNamespaceName'), '/RootManageSharedAccessKey')]",
"location": "[variables('location')]",
"dependsOn": [
"[resourceId('Microsoft.EventHub/namespaces', variables('eventHubsNamespaceName'))]"
],
"properties": {
"rights": [
"Listen",
"Manage",
"Send"
]
}
},
{
"type": "Microsoft.EventHub/namespaces/eventhubs",
"apiVersion": "2017-04-01",
"name": "[concat(variables('eventHubsNamespaceName'), '/binder-test')]",
"location": "[variables('location')]",
"dependsOn": [
"[resourceId('Microsoft.EventHub/namespaces', variables('eventHubsNamespaceName'))]"
],
"properties": {
"messageRetentionInDays": 1,
"partitionCount": 1,
"status": "Active"
}
},
{
"type": "Microsoft.EventHub/namespaces/networkRuleSets",
"apiVersion": "2018-01-01-preview",
"name": "[concat(variables('eventHubsNamespaceName'), '/default')]",
"location": "[variables('location')]",
"dependsOn": [
"[resourceId('Microsoft.EventHub/namespaces', variables('eventHubsNamespaceName'))]"
],
"properties": {
"defaultAction": "Deny",
"virtualNetworkRules": [],
"ipRules": []
}
},
{
"type": "Microsoft.EventHub/namespaces/eventhubs/consumergroups",
"apiVersion": "2017-04-01",
"name": "[concat(variables('eventHubsNamespaceName'), '/binder-test/$Default')]",
"location": "[variables('location')]",
"dependsOn": [
"[resourceId('Microsoft.EventHub/namespaces/eventhubs', variables('eventHubsNamespaceName'), 'binder-test')]",
"[resourceId('Microsoft.EventHub/namespaces', variables('eventHubsNamespaceName'))]"
],
"properties": {}
},
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2019-06-01",
"name": "[variables('storageAccountName')]",
"location": "[variables('location')]",
"sku": {
"name": "Standard_RAGRS",
"tier": "Standard"
},
"kind": "StorageV2",
"properties": {
"networkAcls": {
"bypass": "AzureServices",
"virtualNetworkRules": [],
"ipRules": [],
"defaultAction": "Allow"
},
"supportsHttpsTrafficOnly": true,
"encryption": {
"services": {
"file": {
"keyType": "Account",
"enabled": true
},
"blob": {
"keyType": "Account",
"enabled": true
}
},
"keySource": "Microsoft.Storage"
},
"accessTier": "Hot"
}
},
{
"type": "Microsoft.Storage/storageAccounts/blobServices",
"apiVersion": "2019-06-01",
"name": "[concat(variables('storageAccountName'), '/default')]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]"
],
"sku": {
"name": "Standard_RAGRS",
"tier": "Standard"
},
"properties": {
"cors": {
"corsRules": []
},
"deleteRetentionPolicy": {
"enabled": false
}
}
},
{
"type": "Microsoft.Storage/storageAccounts/fileServices",
"apiVersion": "2019-06-01",
"name": "[concat(variables('storageAccountName'), '/default')]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]"
],
"sku": {
"name": "Standard_RAGRS",
"tier": "Standard"
},
"properties": {
"cors": {
"corsRules": []
}
}
},
{
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"apiVersion": "2019-06-01",
"name": "[concat(variables('storageAccountName'), '/default/binder-test')]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts/blobServices', variables('storageAccountName'), 'default')]",
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]"
],
"properties": {
"publicAccess": "None"
}
}
],
"outputs": {
"STORAGE_ACCOUNT_BINDER": {
"type": "string",
"value": "[variables('storageAccountName')]"
},
"STORAGE_ACCOUNT_KEY_BINDER": {
"type": "string",
"value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2019-06-01').keys[0].value]"
},
"EVENTHUB_CONNECTION_STRING_BINDER": {
"type": "string",
"value": "[listKeys(resourceId('Microsoft.EventHub/namespaces/authorizationRules', variables('eventHubsNamespaceName'), variables('eventHubsNamespaceKeyName')), '2017-04-01').primaryConnectionString]"
}
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

empty line

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
<version>1.0.0</version> <!-- {x-version-update;com.azure.spring:azure-spring-cloud-sample-eventhubs-kafka;current} -->
<name>Azure Spring Cloud Sample Event Hubs Kafka</name>

<properties>
<skipSpringITs>true</skipSpringITs>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
Expand Down Expand Up @@ -76,5 +80,38 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.7.1</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-engine;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.7.1</version> <!-- {x-version-update;org.junit.vintage:junit-vintage-engine;external_dependency} -->
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-failsafe-plugin;external_dependency} -->
<executions>
<execution>
<id>default</id>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<skipITs>${skipSpringITs}</skipITs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Loading