Spring 애플리케이션에서 Event Hubs 사용

이 문서에서는 Spring Framework 사용하여 빌드된 Java 애플리케이션에서 Azure Event Hubs 사용하는 방법을 보여 줍니다.

Azure Event Hubs 빅 데이터 스트리밍 플랫폼 및 이벤트 수집 서비스입니다. 초당 수백만 개의 이벤트를 수신하고 처리할 수 있습니다. 이벤트 허브로 전송된 데이터는 실시간 분석 공급자 또는 일괄 처리/스토리지 어댑터를 사용하여 변환하고 저장할 수 있습니다.

Spring Cloud Azure Spring 프레임워크를 사용하여 Event Hubs로 메시지를 보내고 받기 위한 다양한 모듈을 제공합니다.

다음 모듈을 독립적으로 사용하거나 다른 사용 사례에 대해 결합할 수 있습니다.

필수 조건

  • Azure Event Hubs 인스턴스입니다. 자세한 내용은 Quickstart: Azure Portal 사용하여 이벤트 허브 만들기를 참조하세요.

  • Event Hubs 검사점의 Azure Storage 계정입니다. 자세한 내용은 스토리지 계정 만들기를 참조하세요.

  • Spring Boot 애플리케이션 없는 경우 Spring Initializr를 사용하여 Maven 프로젝트를 만듭니다. Maven Project을 선택하고 아래에서 Spring Web 종속성을 추가한 다음, Java 버전 8 이상을 선택합니다.

참고

계정에 리소스에 대한 액세스 권한을 부여하려면 Azure Event Hubs 현재 사용 중인 Microsoft Entra 계정에 Azure Event Hubs Data Receiver 및 Azure Event Hubs Data Sender 역할을 할당합니다. 그런 다음, Azure Storage 계정에서 현재 사용 중인 Microsoft Entra 계정에 Storage Blob Data Contributor 역할을 할당합니다. 액세스 역할 부여에 대한 자세한 내용은 Azure 포털을 사용하여 Azure 역할 할당 및 Microsoft Entra ID 사용하여 Event Hubs 리소스에 대한 액세스 권한 부여를 참조하세요.

중요

이 자습서의 단계를 완료하려면 Spring Boot 버전 2.5 이상이 필요합니다.

로컬 환경 준비

이 자습서에서는 구성 및 코드에 인증 작업이 없습니다. 그러나 Azure 서비스에 연결하려면 인증이 필요합니다. 인증을 완료하려면 Azure ID 클라이언트 라이브러리를 사용해야 합니다. Spring Cloud Azure 코드 변경 없이 자격 증명을 가져오는 데 도움이 되도록 Azure ID 라이브러리에서 제공하는 DefaultAzureCredential 사용합니다.

DefaultAzureCredential은 여러 인증 방법을 지원하고 런타임에 사용할 방법을 결정합니다. 이 방법을 사용하면 앱이 환경별 코드를 구현하지 않고 로컬 또는 프로덕션 환경과 같은 다양한 환경에서 다양한 인증 방법을 사용할 수 있습니다. 자세한 내용은 DefaultAzureCredential 섹션을 참조하세요Azure 호스팅된 Java 애플리케이션 인증.

Azure CLI, IntelliJ 또는 기타 방법을 사용하여 로컬 개발 환경에서 인증을 완료하려면 Java 개발 환경에서 Azure 인증 참조하세요. Azure 호스팅 환경에서 인증을 완료하려면 관리 ID를 사용하는 것이 좋습니다. 자세한 내용은 Azure 리소스에 대한 관리 ID는 무엇입니까?

Spring Cloud Azure Event Hubs Starter 사용

Spring Cloud Azure Event Hubs Starter 모듈은 Spring Boot 프레임워크를 사용하여 Event Hubs Java 클라이언트 라이브러리 가져옵니다. 상호 배타적이지 않은 패턴으로 Spring Cloud Azure 및 Azure SDK 함께 사용할 수 있습니다. 따라서 Spring 애플리케이션에서 Event Hubs Java 클라이언트 API를 계속 사용할 수 있습니다.

종속성 추가

Spring Cloud Azure Event Hubs Starter 모듈을 설치하려면 pom.xml 파일에 다음 종속성을 추가합니다.

  • Spring Cloud Azure BOM(구성 명세서):

    <dependencyManagement>
       <dependencies>
         <dependency>
           <groupId>com.azure.spring</groupId>
           <artifactId>spring-cloud-azure-dependencies</artifactId>
           <version>7.4.0</version>
           <type>pom</type>
           <scope>import</scope>
           </dependency>
       </dependencies>
    </dependencyManagement>
    

    참고

    Spring Boot 4.0.x를 사용하는 경우 버전을 7.4.0.로 설정합니다spring-cloud-azure-dependencies.

    Spring Boot 3.5.x를 사용하는 경우 버전을 6.5.0.로 설정합니다spring-cloud-azure-dependencies.

    Spring Boot 3.1.x-3.5.x를 사용하는 경우, spring-cloud-azure-dependencies 버전을 5.25.0로 설정해야 합니다.

    Spring Boot 2.x를 사용하는 경우 spring-cloud-azure-dependencies 버전을 4.20.0로 설정해야 합니다.

    이 BOM(자재 명세서)을 <dependencyManagement> 섹션의 pom.xml 파일에서 구성해야 합니다. 이렇게 하면 모든 Spring Cloud Azure 종속성이 동일한 버전을 사용하게 됩니다.

    이 BOM에 사용되는 버전에 대한 자세한 내용은 스프링 클라우드 Azure 사용해야 하는 경우 참조하세요.

  • Spring Cloud Azure Event Hubs 아티팩트:

    <dependency>
      <groupId>com.azure.spring</groupId>
      <artifactId>spring-cloud-azure-starter-eventhubs</artifactId>
    </dependency>
    

메시지를 보내고 받도록 애플리케이션 코딩

이 가이드에서는 Spring 애플리케이션의 컨텍스트에서 Event Hubs Java 클라이언트를 사용하는 방법을 설명합니다. 여기서는 다음 두 가지 옵션을 소개합니다.

  • Spring Boot 자동 구성을 사용하고 Spring 컨텍스트에서 기본 제공 클라이언트를 사용합니다(권장).
  • 프로그래밍 방식으로 클라이언트를 빌드합니다.

Spring IoC 컨테이너에서 클라이언트 빈을 자동 배선하는 방법에는 Event Hubs 클라이언트를 사용하여 개발할 때 보다 유연하고 효율적인 환경을 제공할 수 있는 다음과 같은 이점이 있습니다.

  • 다른 환경에서 동일한 애플리케이션 코드를 사용할 수 있도록 외부화된 구성 을 적용합니다.
  • 작성기 패턴을 학습하고 이 클라이언트를 애플리케이션 컨텍스트에 등록하는 프로세스를 Spring Boot 프레임워크에 위임할 수 있습니다. 이 위임을 사용하면 고유한 비즈니스 요구 사항으로 클라이언트를 사용하는 방법에 집중할 수 있습니다.
  • 상태 표시기를 사용하여 애플리케이션 및 내부 구성 요소의 상태와 상태를 쉽게 검사할 수 있습니다.

다음 섹션에서는 사용하는 EventProcessorClientEventHubProducerClient 방법과 두 가지 대안을 보여 주는 코드 예제를 제공합니다.

참고

event Hubs용 Azure Java SDK는 Event Hubs와 상호 작용할 수 있는 여러 클라이언트를 제공합니다. 또한 시작은 모든 Event Hubs 클라이언트와 클라이언트 빌더에 대한 자동 구성을 제공합니다. 이 문서에서는 예제로만 EventProcessorClientEventHubProducerClient 사용합니다.

Spring Boot 자동 구성 사용

Event Hubs에 메시지를 보내고 메시지를 받으려면 다음 단계를 사용하여 애플리케이션을 구성합니다.

  1. 다음 속성 설정을 사용하여 Event Hubs 네임스페이스 및 이벤트 허브 이름을 구성합니다.

    spring.cloud.azure.eventhubs.namespace=<your event-hubs-namespace>
    spring.cloud.azure.eventhubs.event-hub-name=<your-event-hub-name>
    spring.cloud.azure.eventhubs.processor.checkpoint-store.account-name=<your-storage-account-name>
    spring.cloud.azure.eventhubs.processor.checkpoint-store.container-name=<your-storage-account-container-name>
    spring.cloud.azure.eventhubs.processor.consumer-group=$Default
    
  2. 다음 예제와 같이 새 EventHubProcessorClientConfiguration Java 클래스를 만듭니다. 이 클래스는 EventProcessorClient에 대한 메시지 및 오류 처리기를 등록하는 데 사용됩니다.

    import com.azure.spring.cloud.service.eventhubs.consumer.EventHubsErrorHandler;
    import com.azure.spring.cloud.service.eventhubs.consumer.EventHubsRecordMessageListener;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import org.springframework.context.annotation.Bean;
    import org.springframework.context.annotation.Configuration;
    
    @Configuration
    public class EventHubProcessorClientConfiguration {
    
        private static final Logger LOGGER = LoggerFactory.getLogger(EventHubProcessorClientConfiguration.class);
    
        @Bean
        EventHubsRecordMessageListener processEvent() {
            return eventContext->LOGGER.info("Processing event from partition {} with sequence number {} with body: {}",
                eventContext.getPartitionContext().getPartitionId(), eventContext.getEventData().getSequenceNumber(),
                eventContext.getEventData().getBodyAsString());
        }
    
        @Bean
        EventHubsErrorHandler processError() {
            return errorContext->LOGGER.info("Error occurred in partition processor for partition {}, {}",
                errorContext.getPartitionContext().getPartitionId(),
                errorContext.getThrowable());
        }
    
    }
    
  3. EventProcessorClient EventHubProducerClient 다음 예제와 같이 Spring 애플리케이션을 삽입하고 관련 API를 호출하여 메시지를 보내고 받습니다.

    import com.azure.messaging.eventhubs.EventData;
    import com.azure.messaging.eventhubs.EventHubProducerClient;
    import com.azure.messaging.eventhubs.EventProcessorClient;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import org.springframework.boot.CommandLineRunner;
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    
    import java.util.Collections;
    import java.util.concurrent.TimeUnit;
    
    @SpringBootApplication
    public class EventHubClientApplication implements CommandLineRunner {
    
        private static final Logger LOGGER = LoggerFactory.getLogger(EventHubClientApplication.class);
        private final EventHubProducerClient eventHubProducerClient;
        private final EventProcessorClient eventProcessorClient;
    
        public EventHubClientApplication(EventHubProducerClient eventHubProducerClient,
                                         EventProcessorClient eventProcessorClient) {
            this.eventHubProducerClient = eventHubProducerClient;
            this.eventProcessorClient = eventProcessorClient;
        }
    
        public static void main(String[] args) {
            SpringApplication.run(EventHubClientApplication.class, args);
        }
    
        @Override
        public void run(String... args) throws Exception {
            eventProcessorClient.start();
            // Wait for the processor client to be ready
            TimeUnit.SECONDS.sleep(10);
    
            eventHubProducerClient.send(Collections.singletonList(new EventData("Hello World")));
            LOGGER.info("Successfully sent a message to Event Hubs.");
            eventHubProducerClient.close();
            LOGGER.info("Skip stopping and closing the processor since the processor may not complete the receiving process yet.");
        }
    
    }
    
  4. 애플리케이션을 시작합니다. 다음 예제와 유사한 로그가 표시됩니다.

    Successfully sent a message to Event Hubs.
    ...
    Processing event from partition 0 with sequence number 0 with body: Hello World
    ...
    Stopping and closing the processor.
    

프로그래밍 방식으로 클라이언트 빌드

클라이언트 빈을 직접 구성할 수 있지만, 그 과정은 복잡합니다. Spring Boot 애플리케이션에서는 속성을 관리하고, 작성기 패턴을 알아보고, Spring 애플리케이션 컨텍스트에 클라이언트를 등록해야 합니다. 다음 단계에서는 이 작업을 수행하는 방법을 보여줍니다.

  1. 다음 예제와 같이 새 EventHubClientConfiguration Java 클래스를 만듭니다. 이 클래스는 EventProcessorClient 및 EventHubProducerClient 빈을 선언하는 데 사용됩니다. 실제 값으로 <your event-hubs-namespace>, <your-event-hub-name>, <your-storage-account-name>, <your-storage-account-container-name> 자리 표시자를 바꿔야 합니다.

    import com.azure.identity.DefaultAzureCredentialBuilder;
    import com.azure.messaging.eventhubs.EventHubClientBuilder;
    import com.azure.messaging.eventhubs.EventHubProducerClient;
    import com.azure.messaging.eventhubs.EventProcessorClient;
    import com.azure.messaging.eventhubs.EventProcessorClientBuilder;
    import com.azure.messaging.eventhubs.checkpointstore.blob.BlobCheckpointStore;
    import com.azure.messaging.eventhubs.models.ErrorContext;
    import com.azure.messaging.eventhubs.models.EventContext;
    import com.azure.storage.blob.BlobContainerAsyncClient;
    import com.azure.storage.blob.BlobContainerClientBuilder;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import org.springframework.context.annotation.Bean;
    import org.springframework.context.annotation.Configuration;
    
    @Configuration
    public class EventHubClientConfiguration {
    
        private static final Logger LOGGER = LoggerFactory.getLogger(EventHubClientConfiguration.class);
        private static final String EVENT_HUB_FULLY_QUALIFIED_NAMESPACE = "<your event-hubs-namespace>.servicebus.windows.net";
        private static final String EVENT_HUB_NAME = "<your-event-hub-name>";
        private static final String CONSUMER_GROUP = "$Default";
        private static final String STORAGE_ACCOUNT_ENDPOINT = "https://<your-storage-account-name>.blob.core.windows.net";
        private static final String STORAGE_CONTAINER_NAME = "<your-storage-account-container-name>";
    
        @Bean
        EventHubClientBuilder eventHubClientBuilder() {
            return new EventHubClientBuilder().credential(EVENT_HUB_FULLY_QUALIFIED_NAMESPACE, EVENT_HUB_NAME,
                new DefaultAzureCredentialBuilder()
                    .build());
        }
    
        @Bean
        BlobContainerClientBuilder blobContainerClientBuilder() {
            return new BlobContainerClientBuilder().credential(new DefaultAzureCredentialBuilder()
                                                       .build())
                                                   .endpoint(STORAGE_ACCOUNT_ENDPOINT)
                                                   .containerName(STORAGE_CONTAINER_NAME);
        }
    
        @Bean
        BlobContainerAsyncClient blobContainerAsyncClient(BlobContainerClientBuilder blobContainerClientBuilder) {
            return blobContainerClientBuilder.buildAsyncClient();
        }
    
        @Bean
        EventProcessorClientBuilder eventProcessorClientBuilder(BlobContainerAsyncClient blobContainerAsyncClient) {
            return new EventProcessorClientBuilder().credential(EVENT_HUB_FULLY_QUALIFIED_NAMESPACE, EVENT_HUB_NAME,
                                                        new DefaultAzureCredentialBuilder()
                                                            .build())
                                                    .consumerGroup(CONSUMER_GROUP)
                                                    .checkpointStore(new BlobCheckpointStore(blobContainerAsyncClient))
                                                    .processEvent(EventHubClientConfiguration::processEvent)
                                                    .processError(EventHubClientConfiguration::processError);
        }
    
        @Bean
        EventHubProducerClient eventHubProducerClient(EventHubClientBuilder eventHubClientBuilder) {
            return eventHubClientBuilder.buildProducerClient();
    
        }
    
        @Bean
        EventProcessorClient eventProcessorClient(EventProcessorClientBuilder eventProcessorClientBuilder) {
            return eventProcessorClientBuilder.buildEventProcessorClient();
        }
    
        public static void processEvent(EventContext eventContext) {
            LOGGER.info("Processing event from partition {} with sequence number {} with body: {}",
                eventContext.getPartitionContext().getPartitionId(), eventContext.getEventData().getSequenceNumber(),
                eventContext.getEventData().getBodyAsString());
        }
    
        public static void processError(ErrorContext errorContext) {
            LOGGER.info("Error occurred in partition processor for partition {}, {}",
                errorContext.getPartitionContext().getPartitionId(),
                errorContext.getThrowable());
        }
    
    }
    
  2. Spring 애플리케이션에 EventProcessorClient와 EventHubProducerClient을 다음 예제와 같이 삽입합니다.

    import com.azure.messaging.eventhubs.EventData;
    import com.azure.messaging.eventhubs.EventHubProducerClient;
    import com.azure.messaging.eventhubs.EventProcessorClient;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import org.springframework.boot.CommandLineRunner;
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    
    import java.util.Collections;
    import java.util.concurrent.TimeUnit;
    
    @SpringBootApplication
    public class EventHubClientApplication implements CommandLineRunner {
    
        private static final Logger LOGGER = LoggerFactory.getLogger(EventHubClientApplication.class);
        private final EventHubProducerClient eventHubProducerClient;
        private final EventProcessorClient eventProcessorClient;
    
        public EventHubClientApplication(EventHubProducerClient eventHubProducerClient,
                                         EventProcessorClient eventProcessorClient) {
            this.eventHubProducerClient = eventHubProducerClient;
            this.eventProcessorClient = eventProcessorClient;
        }
    
        public static void main(String[] args) {
            SpringApplication.run(EventHubClientApplication.class, args);
        }
    
        @Override
        public void run(String... args) throws Exception {
            eventProcessorClient.start();
            // Wait for the processor client to be ready
            TimeUnit.SECONDS.sleep(10);
    
            eventHubProducerClient.send(Collections.singletonList(new EventData("Hello World")));
            LOGGER.info("Successfully sent a message to Event Hubs.");
            eventHubProducerClient.close();
            LOGGER.info("Stopping and closing the processor");
            eventProcessorClient.stop();
        }
    
    }
    
  3. 애플리케이션을 시작합니다. 다음 예제와 유사한 로그가 표시됩니다.

    Successfully sent a message to Event Hubs.
    ...
    Processing event from partition 0 with sequence number 0 with body: Hello World
    ...
    Stopping and closing the processor.
    

다음 목록에서는 이 코드가 유연하지 않거나 정상적이지 않은 몇 가지 이유를 보여 줍니다.

  • Event Hubs 네임스페이스 및 이벤트 허브 이름은 하드 코딩됩니다.
  • Spring 환경에서 구성을 가져오는 데 사용하는 @Value 경우 application.properties 파일에 IDE 힌트를 가질 수 없습니다.
  • 마이크로 서비스 시나리오가 있는 경우 각 프로젝트에서 코드를 복제해야 하며 실수를 하기 쉽고 일관성을 갖기 어렵습니다.

다행히 Spring Cloud Azure에서는 클라이언트 빈을 직접 빌드할 필요가 없습니다. 대신 직접 삽입하고 이미 익숙한 구성 속성을 사용하여 Storage 큐를 구성할 수 있습니다. 자세한 내용은 Spring Cloud Azure 구성 참조하세요.

또한 Spring Cloud Azure 다양한 시나리오에 대해 다음과 같은 전역 구성을 제공합니다. 자세한 내용은 Azure Service SDK에 대한 글로벌 구성Spring Cloud Azure 구성 섹션을 참조하세요.

  • 프록시 옵션입니다.
  • 다시 시도 옵션입니다.
  • AMQP 전송 클라이언트 옵션입니다.

다른 Azure 클라우드에 연결할 수도 있습니다. 자세한 내용은 Azure 클라우드에 연결 참조하세요.

Spring Messaging를 사용하여 Azure Event Hubs 사용

Spring Messaging Azure Event Hubs 모듈은 Event Hubs를 사용하여 Spring Messaging 프레임워크를 지원합니다.

Spring Messaging Azure Event Hubs 사용하는 경우 다음 기능을 사용할 수 있습니다.

  • EventHubsTemplate: 메시지를 Event Hubs에 비동기 및 동기 방식으로 보냅니다.
  • @EventHubsListener: 대상에서 Event Hubs 메시지 수신기의 대상으로 메서드를 표시합니다.

이 가이드에서는 Spring Messaging Azure Event Hubs 사용하여 Event Hubs에 메시지를 보내고 받는 방법을 보여 줍니다.

종속성 추가

Spring Messaging Azure Event Hubs 모듈을 설치하려면 pom.xml 파일에 다음 종속성을 추가합니다.

  • Spring Cloud Azure BOM(구성 명세서):

    <dependencyManagement>
       <dependencies>
         <dependency>
           <groupId>com.azure.spring</groupId>
           <artifactId>spring-cloud-azure-dependencies</artifactId>
           <version>7.4.0</version>
           <type>pom</type>
           <scope>import</scope>
           </dependency>
       </dependencies>
    </dependencyManagement>
    

    참고

    Spring Boot 4.0.x를 사용하는 경우 버전을 7.4.0.로 설정합니다spring-cloud-azure-dependencies.

    Spring Boot 3.5.x를 사용하는 경우 버전을 6.5.0.로 설정합니다spring-cloud-azure-dependencies.

    Spring Boot 3.1.x-3.5.x를 사용하는 경우, spring-cloud-azure-dependencies 버전을 5.25.0로 설정해야 합니다.

    Spring Boot 2.x를 사용하는 경우 spring-cloud-azure-dependencies 버전을 4.20.0로 설정해야 합니다.

    이 BOM(자재 명세서)을 <dependencyManagement> 섹션의 pom.xml 파일에서 구성해야 합니다. 이렇게 하면 모든 Spring Cloud Azure 종속성이 동일한 버전을 사용하게 됩니다.

    이 BOM에 사용되는 버전에 대한 자세한 내용은 스프링 클라우드 Azure 사용해야 하는 경우 참조하세요.

  • Spring Cloud Azure 스타터, Spring Messaging 이벤트 허브 및 Azure 이벤트 허브 체크포인트 저장소 아티팩트:

    <dependency>
      <groupId>com.azure.spring</groupId>
      <artifactId>spring-cloud-azure-starter</artifactId>
    </dependency>
    <dependency>
      <groupId>com.azure.spring</groupId>
      <artifactId>spring-messaging-azure-eventhubs</artifactId>
    </dependency>
    <dependency>
      <groupId>com.azure</groupId>
      <artifactId>azure-messaging-eventhubs-checkpointstore-blob</artifactId>
    </dependency>
    

메시지를 보내고 받도록 애플리케이션 코딩

Event Hubs에 메시지를 보내고 메시지를 받으려면 다음 단계를 사용하여 애플리케이션을 구성합니다.

  1. 다음 속성 설정을 사용하여 Event Hubs 네임스페이스 및 스토리지 Blob을 구성합니다.

    spring.cloud.azure.eventhubs.namespace=<your event-hubs-namespace>
    spring.cloud.azure.eventhubs.processor.checkpoint-store.account-name=<your-storage-account-name>
    spring.cloud.azure.eventhubs.processor.checkpoint-store.container-name=<your-storage-account-container-name>
    
  2. 다음 예제와 같이 새 ConsumerService Java 클래스를 만듭니다. 이 클래스는 메시지 수신자를 정의하는 데 사용됩니다. <your-event-hub-name> 자리 표시자를 실제 값으로 반드시 바꿔야 합니다.

    import com.azure.spring.messaging.eventhubs.implementation.core.annotation.EventHubsListener;
    import org.springframework.stereotype.Service;
    
    @Service
    public class ConsumerService {
    
        private static final String EVENT_HUB_NAME = "<your-event-hub-name>";
        private static final String CONSUMER_GROUP = "$DEFAULT";
    
        @EventHubsListener(destination = EVENT_HUB_NAME, group = CONSUMER_GROUP)
        public void handleMessageFromEventHub(String message) {
            System.out.printf("New message received: %s%n", message);
        }
    
    }
    
  3. 다음 예제와 같이 보낸 사람과 수신자를 연결하여 Spring을 사용하여 메시지를 보내고 받습니다. <your-event-hub-name> 자리 표시자를 실제 값으로 반드시 바꿔야 합니다.

    import com.azure.spring.messaging.eventhubs.core.EventHubsTemplate;
    import com.azure.spring.messaging.implementation.annotation.EnableAzureMessaging;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.context.ConfigurableApplicationContext;
    import org.springframework.messaging.support.MessageBuilder;
    
    @SpringBootApplication
    @EnableAzureMessaging
    public class EventHubMessagingApplication {
    
        private static final String EVENT_HUB_NAME = "<your-event-hub-name>";
        private static final Logger LOGGER = LoggerFactory.getLogger(EventHubMessagingApplication.class);
    
        public static void main(String[] args) {
            ConfigurableApplicationContext applicationContext = SpringApplication.run(EventHubMessagingApplication.class);
            EventHubsTemplate eventHubsTemplate = applicationContext.getBean(EventHubsTemplate.class);
            LOGGER.info("Sending a message to the Event Hubs.");
            eventHubsTemplate.sendAsync(EVENT_HUB_NAME, MessageBuilder.withPayload("Hello world").build()).subscribe();
        }
    
    }
    

    팁

    @EnableAzureMessaging 주석을 추가하여 @EventHubsListener로 주석된 메서드를 검색하고 자동으로 메시지 수신기 컨테이너를 생성합니다.

  4. 애플리케이션을 시작합니다. 다음 예제와 유사한 로그가 표시됩니다.

    Sending a message to the Event Hubs.
    New message received: Hello world
    

Spring Integration Azure Event Hubs 사용

Spring Integration Azure Event Hubs 모듈은 Event Hubs를 사용하여 Spring Integration 프레임워크를 지원합니다.

Spring 애플리케이션에서 Spring Integration 메시지 채널을 사용하는 경우 채널 어댑터를 사용하여 메시지 채널과 Event Hubs 간에 메시지를 라우팅할 수 있습니다.

인바운드 채널 어댑터는 이벤트 허브에서 메시지 채널로 메시지를 전달합니다. 아웃바운드 채널 어댑터는 메시지 채널에서 이벤트 허브로 메시지를 게시합니다.

이 가이드에서는 Spring Integration Azure Event Hubs 사용하여 Event Hubs에 메시지를 보내고 받는 방법을 보여 줍니다.

종속성 추가

Spring Cloud Azure Event Hubs Integration Starter 모듈을 설치하려면 pom.xml 파일에 다음 종속성을 추가합니다.

  • Spring Cloud Azure BOM(구성 명세서):

    <dependencyManagement>
       <dependencies>
         <dependency>
           <groupId>com.azure.spring</groupId>
           <artifactId>spring-cloud-azure-dependencies</artifactId>
           <version>7.4.0</version>
           <type>pom</type>
           <scope>import</scope>
           </dependency>
       </dependencies>
    </dependencyManagement>
    

    참고

    Spring Boot 4.0.x를 사용하는 경우 버전을 7.4.0.로 설정합니다spring-cloud-azure-dependencies.

    Spring Boot 3.5.x를 사용하는 경우 버전을 6.5.0.로 설정합니다spring-cloud-azure-dependencies.

    Spring Boot 3.1.x-3.5.x를 사용하는 경우, spring-cloud-azure-dependencies 버전을 5.25.0로 설정해야 합니다.

    Spring Boot 2.x를 사용하는 경우 spring-cloud-azure-dependencies 버전을 4.20.0로 설정해야 합니다.

    이 BOM(자재 명세서)을 <dependencyManagement> 섹션의 pom.xml 파일에서 구성해야 합니다. 이렇게 하면 모든 Spring Cloud Azure 종속성이 동일한 버전을 사용하게 됩니다.

    이 BOM에 사용되는 버전에 대한 자세한 내용은 스프링 클라우드 Azure 사용해야 하는 경우 참조하세요.

  • Spring Cloud Azure Event Hubs 통합 아티팩트:

    <dependency>
      <groupId>com.azure.spring</groupId>
      <artifactId>spring-cloud-azure-starter-integration-eventhubs</artifactId>
    </dependency>
    

메시지를 보내고 받도록 애플리케이션 코딩

Event Hubs에 메시지를 보내고 메시지를 받으려면 다음 단계를 사용하여 애플리케이션을 구성합니다.

  1. 다음 속성 설정을 사용하여 Event Hubs 네임스페이스 및 스토리지 Blob을 구성합니다.

    spring.cloud.azure.eventhubs.namespace=<your event-hubs-namespace>
    spring.cloud.azure.eventhubs.processor.checkpoint-store.account-name=<your-storage-account-name>
    spring.cloud.azure.eventhubs.processor.checkpoint-store.container-name=<your-storage-account-container-name>
    
  2. 다음 예제와 같이 새 MessageReceiveConfiguration Java 클래스를 만듭니다. 이 클래스는 메시지 수신자를 정의하는 데 사용됩니다. <your-event-hub-name> 자리 표시자를 실제 값으로 반드시 바꿔야 합니다.

    import com.azure.spring.integration.eventhubs.inbound.EventHubsInboundChannelAdapter;
    import com.azure.spring.messaging.eventhubs.core.EventHubsProcessorFactory;
    import com.azure.spring.messaging.eventhubs.core.checkpoint.CheckpointConfig;
    import com.azure.spring.messaging.eventhubs.core.checkpoint.CheckpointMode;
    import com.azure.spring.messaging.eventhubs.core.listener.EventHubsMessageListenerContainer;
    import com.azure.spring.messaging.eventhubs.core.properties.EventHubsContainerProperties;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import org.springframework.beans.factory.annotation.Qualifier;
    import org.springframework.context.annotation.Bean;
    import org.springframework.context.annotation.Configuration;
    import org.springframework.integration.annotation.ServiceActivator;
    import org.springframework.integration.channel.DirectChannel;
    import org.springframework.messaging.MessageChannel;
    
    @Configuration
    public class MessageReceiveConfiguration {
    
        private static final String INPUT_CHANNEL = "input";
        private static final String EVENT_HUB_NAME = "<your-event-hub-name>";
        private static final String CONSUMER_GROUP = "$Default";
        private static final Logger LOGGER = LoggerFactory.getLogger(MessageReceiveConfiguration.class);
    
        @ServiceActivator(inputChannel = INPUT_CHANNEL)
        public void messageReceiver(byte[] payload) {
            String message = new String(payload);
            LOGGER.info("New message received: {}", message);
        }
    
        @Bean
        public EventHubsMessageListenerContainer messageListenerContainer(EventHubsProcessorFactory processorFactory) {
            EventHubsContainerProperties containerProperties = new EventHubsContainerProperties();
            containerProperties.setEventHubName(EVENT_HUB_NAME);
            containerProperties.setConsumerGroup(CONSUMER_GROUP);
            containerProperties.setCheckpointConfig(new CheckpointConfig(CheckpointMode.MANUAL));
            return new EventHubsMessageListenerContainer(processorFactory, containerProperties);
        }
    
        @Bean
        public EventHubsInboundChannelAdapter messageChannelAdapter(@Qualifier(INPUT_CHANNEL) MessageChannel inputChannel,
                                                                    EventHubsMessageListenerContainer listenerContainer) {
            EventHubsInboundChannelAdapter adapter = new EventHubsInboundChannelAdapter(listenerContainer);
            adapter.setOutputChannel(inputChannel);
            return adapter;
        }
    
        @Bean
        public MessageChannel input() {
            return new DirectChannel();
        }
    
    }
    
  3. 다음 예제와 같이 새 MessageSendConfiguration Java 클래스를 만듭니다. 이 클래스는 메시지 발신자를 정의하는 데 사용됩니다. <your-event-hub-name> 자리 표시자를 실제 값으로 반드시 바꿔야 합니다.

    import com.azure.spring.integration.core.handler.DefaultMessageHandler;
    import com.azure.spring.messaging.eventhubs.core.EventHubsTemplate;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import org.springframework.context.annotation.Bean;
    import org.springframework.context.annotation.Configuration;
    import org.springframework.integration.annotation.MessagingGateway;
    import org.springframework.integration.annotation.ServiceActivator;
    import org.springframework.messaging.MessageHandler;
    import org.springframework.util.concurrent.ListenableFutureCallback;
    
    @Configuration
    public class MessageSendConfiguration {
    
        private static final Logger LOGGER = LoggerFactory.getLogger(MessageSendConfiguration.class);
        private static final String OUTPUT_CHANNEL = "output";
        private static final String EVENT_HUB_NAME = "<your-event-hub-name>";
    
        @Bean
        @ServiceActivator(inputChannel = OUTPUT_CHANNEL)
        public MessageHandler messageSender(EventHubsTemplate eventHubsTemplate) {
            DefaultMessageHandler handler = new DefaultMessageHandler(EVENT_HUB_NAME, eventHubsTemplate);
            handler.setSendCallback(new ListenableFutureCallback<Void>() {
                @Override
                public void onSuccess(Void result) {
                    LOGGER.info("Message was sent successfully.");
                }
    
                @Override
                public void onFailure(Throwable ex) {
                    LOGGER.error("There was an error sending the message.", ex);
                }
            });
    
            return handler;
        }
    
        @MessagingGateway(defaultRequestChannel = OUTPUT_CHANNEL)
        public interface EventHubOutboundGateway {
            void send(String text);
        }
    
    }
    
  4. 다음 예제와 같이 보낸 사람과 수신자를 연결하여 Spring을 사용하여 메시지를 보내고 받습니다.

    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.context.ConfigurableApplicationContext;
    import org.springframework.context.annotation.Configuration;
    import org.springframework.integration.config.EnableIntegration;
    
    @SpringBootApplication
    @EnableIntegration
    @Configuration(proxyBeanMethods = false)
    public class EventHubIntegrationApplication {
    
        public static void main(String[] args) {
            ConfigurableApplicationContext applicationContext = SpringApplication.run(EventHubIntegrationApplication.class, args);
            MessageSendConfiguration.EventHubOutboundGateway outboundGateway = applicationContext.getBean(MessageSendConfiguration.EventHubOutboundGateway.class);
            outboundGateway.send("Hello World");
        }
    }
    

    팁

    Spring Integration 인프라를 활용하기 위해 @EnableIntegration 주석을 추가하는 것을 잊지 마세요.

  5. 애플리케이션을 시작합니다. 다음 예제와 유사한 로그가 표시됩니다.

    Message was sent successfully.
    New message received: Hello World
    

Spring Cloud Azure Stream Event Hubs 바인더 사용

Spring Cloud Stream 애플리케이션에서 Event Hubs API를 호출하려면 Spring Cloud Azure Event Hubs Stream Binder 모듈을 사용합니다.

이 가이드에서는 Spring Cloud Stream Event Hubs 바인더를 사용하여 Event Hubs에 메시지를 보내고 받는 방법을 보여 줍니다.

종속성 추가

Spring Cloud Azure Event Hubs Stream Binder 모듈을 설치하려면 pom.xml 파일에 다음 종속성을 추가합니다.

  • Spring Cloud Azure BOM(구성 명세서):

    <dependencyManagement>
       <dependencies>
         <dependency>
           <groupId>com.azure.spring</groupId>
           <artifactId>spring-cloud-azure-dependencies</artifactId>
           <version>7.4.0</version>
           <type>pom</type>
           <scope>import</scope>
           </dependency>
       </dependencies>
    </dependencyManagement>
    

    참고

    Spring Boot 4.0.x를 사용하는 경우 버전을 7.4.0.로 설정합니다spring-cloud-azure-dependencies.

    Spring Boot 3.5.x를 사용하는 경우 버전을 6.5.0.로 설정합니다spring-cloud-azure-dependencies.

    Spring Boot 3.1.x-3.5.x를 사용하는 경우, spring-cloud-azure-dependencies 버전을 5.25.0로 설정해야 합니다.

    Spring Boot 2.x를 사용하는 경우 spring-cloud-azure-dependencies 버전을 4.20.0로 설정해야 합니다.

    이 BOM(자재 명세서)을 <dependencyManagement> 섹션의 pom.xml 파일에서 구성해야 합니다. 이렇게 하면 모든 Spring Cloud Azure 종속성이 동일한 버전을 사용하게 됩니다.

    이 BOM에 사용되는 버전에 대한 자세한 내용은 스프링 클라우드 Azure 사용해야 하는 경우 참조하세요.

  • Spring Cloud Azure Event Hubs Stream Binder 아티팩트:

    <dependency>
      <groupId>com.azure.spring</groupId>
      <artifactId>spring-cloud-azure-stream-binder-eventhubs</artifactId>
    </dependency>
    

메시지를 보내고 받도록 애플리케이션 코딩

Event Hubs에 메시지를 보내고 메시지를 받으려면 다음 단계를 사용하여 애플리케이션을 구성합니다.

  1. 다음 속성 설정을 사용하여 Event Hubs 네임스페이스 및 스토리지 Blob을 구성합니다.

    spring.cloud.azure.eventhubs.namespace=<your event-hubs-namespace>
    spring.cloud.azure.eventhubs.processor.checkpoint-store.account-name=<your-storage-account-name>
    spring.cloud.azure.eventhubs.processor.checkpoint-store.container-name=<your-storage-account-container-name>
    
  2. 메시지 수신기를 만듭니다.

    애플리케이션을 이벤트 싱크로 사용하려면 다음 작업을 완료하여 입력 바인더를 구성합니다.

    • Consumer 메시지 처리 논리를 정의하는 빈을 선언합니다. 예를 들어 다음 콩의 이름은 Consumer다음과 같습니다consume.

      @Bean
      public Consumer<Message<String>> consume() {
           return message -> {
               System.out.printf("New message received: %s%n", message.getPayload());
           };
      }
      
    • 다음 구성을 추가하여 사용 이름을 Event Hub 지정합니다. <your-event-hub-name> 자리 표시자를 실제 값으로 반드시 바꿔야 합니다.

      # name for the above `Consumer` bean
      spring.cloud.stream.function.definition=consume
      spring.cloud.stream.bindings.consume-in-0.destination=<your-event-hub-name>
      spring.cloud.stream.bindings.consume-in-0.group=$Default
      spring.cloud.stream.eventhubs.bindings.consume-in-0.consumer.checkpoint.mode=MANUAL
      
  3. 메시지 발신자를 만듭니다.

    애플리케이션을 이벤트 원본으로 사용하려면 다음 작업을 완료하여 출력 바인더를 구성합니다.

    • Supplier 다음 예제와 같이 애플리케이션 내에서 메시지가 들어오는 위치를 정의하는 빈을 정의합니다.

      @Bean
      public Supplier<Message<String>> supply() {
          return () -> {
              System.out.println("Sending a message.");
              return MessageBuilder.withPayload("Hello world").build();
          };
      }
      
    • 다음 구성을 추가하여 전송할 이름으로 Event Hub을(를) 지정합니다. <your-event-hub-name> 자리 표시자를 실제 값으로 반드시 바꿔야 합니다.

      # "consume" is added from the above step
      spring.cloud.stream.function.definition=consume;supply
      spring.cloud.stream.bindings.supply-out-0.destination=<your-event-hub-name>
      
  4. 애플리케이션을 시작합니다. 다음 예제와 유사한 로그가 표시됩니다.

    Sending a message.
    New message received: Hello world.
    

Azure Event Hubs 함께 Spring Kafka 사용

Event Hubs는 기존 Kafka 기반 애플리케이션에서 사용할 수 있는 Kafka 엔드포인트를 제공합니다. 이 방법은 사용자 고유의 Kafka 클러스터를 실행하는 대신 사용할 수 있습니다. Event Hubs는 대부분의 기존 Kafka 애플리케이션에서 작동합니다. 자세한 내용은 Apache Kafka용 Event Hubs를 참조하세요.

이 가이드에서는 Azure Event Hubs 및 Spring Kafka를 사용하여 Event Hubs에 메시지를 보내고 받는 방법을 보여 줍니다.

종속성 추가

Spring Cloud Azure 시작 및 Spring Kafka 모듈을 설치하려면 pom.xml 파일에 다음 종속성을 추가합니다.

  • Spring Cloud Azure BOM(구성 명세서):

    <dependencyManagement>
       <dependencies>
         <dependency>
           <groupId>com.azure.spring</groupId>
           <artifactId>spring-cloud-azure-dependencies</artifactId>
           <version>7.4.0</version>
           <type>pom</type>
           <scope>import</scope>
           </dependency>
       </dependencies>
    </dependencyManagement>
    

    참고

    Spring Boot 4.0.x를 사용하는 경우 버전을 7.4.0.로 설정합니다spring-cloud-azure-dependencies.

    Spring Boot 3.5.x를 사용하는 경우 버전을 6.5.0.로 설정합니다spring-cloud-azure-dependencies.

    Spring Boot 3.1.x-3.5.x를 사용하는 경우, spring-cloud-azure-dependencies 버전을 5.25.0로 설정해야 합니다.

    Spring Boot 2.x를 사용하는 경우 spring-cloud-azure-dependencies 버전을 4.20.0로 설정해야 합니다.

    이 BOM(자재 명세서)을 <dependencyManagement> 섹션의 pom.xml 파일에서 구성해야 합니다. 이렇게 하면 모든 Spring Cloud Azure 종속성이 동일한 버전을 사용하게 됩니다.

    이 BOM에 사용되는 버전에 대한 자세한 내용은 스프링 클라우드 Azure 사용해야 하는 경우 참조하세요.

  • Spring Cloud Azure 시작 및 Spring Kafka 아티팩트:

    <dependency>
      <groupId>com.azure.spring</groupId>
      <artifactId>spring-cloud-azure-starter</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.kafka</groupId>
      <artifactId>spring-kafka</artifactId>
    </dependency>
    

메시지를 보내고 받도록 애플리케이션 코딩

Event Hubs에 메시지를 보내고 메시지를 받으려면 다음 단계를 사용하여 애플리케이션을 구성합니다.

  1. 다음 속성 설정을 사용하여 Event Hubs 네임스페이스를 구성합니다.

    spring.kafka.bootstrap-servers=<your event-hubs-namespace>.servicebus.windows.net:9093
    
  2. 다음 예제에서처럼, 메시지를 보내는 데 KafkaTemplate를 사용하고, 메시지를 받는 데 @KafkaListener를 사용합니다. <your-event-hub-name> 자리 표시자를 실제 값으로 반드시 바꿔야 합니다.

    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import org.springframework.boot.CommandLineRunner;
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.kafka.annotation.KafkaListener;
    import org.springframework.kafka.core.KafkaTemplate;
    
    @SpringBootApplication
    public class EventHubKafkaApplication implements CommandLineRunner {
    
        private static final Logger LOGGER = LoggerFactory.getLogger(EventHubKafkaApplication.class);
        private static final String EVENT_HUB_NAME = "<your-event-hub-name>";
        private static final String CONSUMER_GROUP = "$Default";
        private final KafkaTemplate<String, String> kafkaTemplate;
    
        public EventHubKafkaApplication(KafkaTemplate<String, String> kafkaTemplate) {
            this.kafkaTemplate = kafkaTemplate;
        }
    
        public static void main(String[] args) {
            SpringApplication.run(EventHubKafkaApplication.class, args);
        }
    
        @Override
        public void run(String... args) {
            kafkaTemplate.send(EVENT_HUB_NAME, "Hello World");
            LOGGER.info("Message was sent successfully.");
        }
    
        @KafkaListener(topics = EVENT_HUB_NAME, groupId = CONSUMER_GROUP)
        public void receive(String message) {
            LOGGER.info("New message received: {}", message);
        }
    
    }
    
  3. 애플리케이션을 시작합니다. 다음 예제와 유사한 로그가 표시됩니다.

    Message was sent successfully.
    New message received: Hello world
    

Azure Event Hubs와 함께 사용하는 Spring Cloud Stream Kafka 바인더

Spring Cloud Stream은 애플리케이션 개발자가 메시지 기반 마이크로 서비스를 작성할 수 있는 프레임워크입니다. 메시징 시스템과 Spring Cloud Stream 간의 연결은 바인더 추상화를 통해 이루어집니다. 바인더는 여러 메시징 시스템에 존재하지만 가장 일반적으로 사용되는 바인더 중 하나는 Apache Kafka용입니다.

이 가이드에서는 Azure Event Hubs 및 Spring Cloud Stream Kafka Binder를 사용하여 Event Hubs에 메시지를 보내고 받는 방법을 보여 줍니다.

종속성 추가

Spring Cloud Azure 스타터 및 Spring Cloud Stream 바인더 Kafka 모듈을 설치하려면 pom.xml 파일에 다음 종속성을 추가합니다.

  • Spring Cloud Azure BOM(구성 명세서):

    <dependencyManagement>
       <dependencies>
         <dependency>
           <groupId>com.azure.spring</groupId>
           <artifactId>spring-cloud-azure-dependencies</artifactId>
           <version>7.4.0</version>
           <type>pom</type>
           <scope>import</scope>
           </dependency>
       </dependencies>
    </dependencyManagement>
    

    참고

    Spring Boot 4.0.x를 사용하는 경우 버전을 7.4.0.로 설정합니다spring-cloud-azure-dependencies.

    Spring Boot 3.5.x를 사용하는 경우 버전을 6.5.0.로 설정합니다spring-cloud-azure-dependencies.

    Spring Boot 3.1.x-3.5.x를 사용하는 경우, spring-cloud-azure-dependencies 버전을 5.25.0로 설정해야 합니다.

    Spring Boot 2.x를 사용하는 경우 spring-cloud-azure-dependencies 버전을 4.20.0로 설정해야 합니다.

    이 BOM(자재 명세서)을 <dependencyManagement> 섹션의 pom.xml 파일에서 구성해야 합니다. 이렇게 하면 모든 Spring Cloud Azure 종속성이 동일한 버전을 사용하게 됩니다.

    이 BOM에 사용되는 버전에 대한 자세한 내용은 스프링 클라우드 Azure 사용해야 하는 경우 참조하세요.

  • Spring Cloud Azure 시작 아티팩트:

    <dependency>
      <groupId>com.azure.spring</groupId>
      <artifactId>spring-cloud-azure-starter</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-stream-binder-kafka</artifactId>
    </dependency>
    

메시지를 보내고 받도록 애플리케이션 코딩

Event Hubs에 메시지를 보내고 메시지를 받으려면 다음 단계를 사용하여 애플리케이션을 구성합니다.

  1. 다음 속성 설정을 사용하여 Kafka broker를 구성합니다.

    spring.cloud.stream.kafka.binder.brokers=<your event-hubs-namespace>.servicebus.windows.net:9093
    
  2. 메시지 수신기를 만듭니다.

    애플리케이션을 이벤트 싱크로 사용하려면 다음 작업을 완료하여 입력 바인더를 구성합니다.

    • Consumer 메시지 처리 논리를 정의하는 빈을 선언합니다. 예를 들어 다음 콩의 이름은 Consumer다음과 같습니다consume.

      @Bean
      public Consumer<Message<String>> consume() {
          return message -> {
              System.out.printf("New message received: %s%n", message.getPayload());
          };
      }
      
    • 다음 구성을 추가하여 사용 이름을 Event Hub 지정합니다. <your-event-hub-name> 자리 표시자를 실제 값으로 반드시 바꿔야 합니다.

      # name for the above `Consumer` bean
      spring.cloud.stream.function.definition=consume
      spring.cloud.stream.bindings.consume-in-0.destination=<your-event-hub-name>
      spring.cloud.stream.bindings.consume-in-0.group=$Default
      
  3. 메시지 발신자를 만듭니다.

    애플리케이션을 이벤트 원본으로 사용하려면 다음 작업을 완료하여 출력 바인더를 구성합니다.

    • Supplier 다음 예제와 같이 애플리케이션 내에서 메시지가 들어오는 위치를 정의하는 빈을 정의합니다.

      @Bean
      public Supplier<Message<String>> supply() {
          return () -> {
              System.out.println("Sending a message.");
              return MessageBuilder.withPayload("Hello world").build();
          };
      }
      
    • 다음 구성을 추가하여 전송할 이름으로 Event Hub을(를) 지정합니다. <your-event-hub-name> 자리 표시자를 실제 값으로 반드시 바꿔야 합니다.

      # "consume" is added from the above step
      spring.cloud.stream.function.definition=consume;supply
      spring.cloud.stream.bindings.supply-out-0.destination=<your-event-hub-name>
      
  4. 애플리케이션을 시작합니다. 다음 예제와 유사한 로그가 표시됩니다.

    Sending a message.
    New message received: Hello world.
    

Azure Spring Apps 배포

이제 Spring Boot 애플리케이션을 로컬로 실행했으므로 이제 프로덕션으로 이동해야 합니다. Azure Spring Apps 사용하면 코드를 변경하지 않고도 Azure Spring Boot 애플리케이션을 쉽게 배포할 수 있습니다. 이 서비스는 개발자가 코드에 집중할 수 있도록 Spring 애플리케이션의 인프라를 관리합니다. Azure Spring Apps 포괄적인 모니터링 및 진단, 구성 관리, 서비스 검색, CI/CD 통합, 청록색 배포 등을 사용하여 수명 주기 관리를 제공합니다. Azure Spring Apps 애플리케이션을 배포하려면 Azure Spring Apps 첫 번째 애플리케이션 배포를 참조하세요.

다음 단계

Spring 개발자를 위한 AzureSpring Cloud Azure Event Hubs 샘플

참고

Microsoft Azure 사용할 수 있는 다른 Spring Boot Starter에 대한 자세한 내용은 Spring Cloud Azure?