Class LegacyJackson2SnsInboundChannelAdapter

java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
org.springframework.integration.gateway.MessagingGatewaySupport
org.springframework.integration.http.inbound.BaseHttpInboundEndpoint
org.springframework.integration.http.inbound.HttpRequestHandlingEndpointSupport
org.springframework.integration.http.inbound.HttpRequestHandlingMessagingGateway
io.awspring.cloud.sns.integration.LegacyJackson2SnsInboundChannelAdapter
All Implemented Interfaces:
Aware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, Lifecycle, Phased, SmartLifecycle, org.springframework.integration.context.ComponentSourceAware, org.springframework.integration.context.ExpressionCapable, org.springframework.integration.context.OrderlyShutdownCapable, org.springframework.integration.IntegrationPattern, org.springframework.integration.support.context.NamedComponent, org.springframework.integration.support.management.IntegrationInboundManagement, org.springframework.integration.support.management.IntegrationManagement, org.springframework.integration.support.management.ManageableLifecycle, org.springframework.integration.support.management.ManageableSmartLifecycle, org.springframework.integration.support.management.TrackableComponent, HttpRequestHandler

public class LegacyJackson2SnsInboundChannelAdapter extends org.springframework.integration.http.inbound.HttpRequestHandlingMessagingGateway
The HttpRequestHandlingMessagingGateway extension for the Amazon WS SNS HTTP(S) endpoints. Accepts all x-amz-sns-message-types, converts the received Topic JSON message to the Map using MappingJackson2HttpMessageConverter and send it to the provided MessagingGatewaySupport.getRequestChannel() as Message payload.

The mapped url must be configured inside the Amazon Web Service platform as a subscription. Before receiving any notification itself, this HTTP endpoint must confirm the subscription.

The handleNotificationStatus flag (defaults to false) indicates that this endpoint should send the SubscriptionConfirmation/UnsubscribeConfirmation messages to the provided MessagingGatewaySupport.getRequestChannel(). If that, the SnsHeaders.NOTIFICATION_STATUS_HEADER header is populated with the NotificationStatus value. In that case it is a responsibility of the application to NotificationStatus.confirmSubscription() or not.

By default, this endpoint just does NotificationStatus.confirmSubscription() for the SubscriptionConfirmation message type. And does nothing for the UnsubscribeConfirmation.

For the convenience on the underlying message flow routing a SnsHeaders.SNS_MESSAGE_TYPE_HEADER header is present.

Since:
4.0
Author:
Artem Bilan, Kamil Przerwa
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.springframework.integration.gateway.MessagingGatewaySupport

    org.springframework.integration.gateway.MessagingGatewaySupport.ConvertingMessagingTemplate

    Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement

    org.springframework.integration.support.management.IntegrationManagement.ManagementOverrides
  • Field Summary

    Fields inherited from class org.springframework.integration.http.inbound.BaseHttpInboundEndpoint

    activeCount, JAXB_PRESENT, NON_READABLE_BODY_HTTP_METHODS, ROME_TOOLS_PRESENT

    Fields inherited from class org.springframework.integration.gateway.MessagingGatewaySupport

    messagingTemplate

    Fields inherited from class org.springframework.integration.endpoint.AbstractEndpoint

    lifecycleLock

    Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport

    EXPRESSION_PARSER, logger

    Fields inherited from interface org.springframework.integration.support.management.IntegrationManagement

    METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME

    Fields inherited from interface org.springframework.context.SmartLifecycle

    DEFAULT_PHASE
  • Constructor Summary

    Constructors
    Constructor
    Description
    LegacyJackson2SnsInboundChannelAdapter(software.amazon.awssdk.services.sns.SnsClient amazonSns, String... path)
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    protected void
     
    protected void
    send(Object object)
     
    void
    setExtractReplyPayload(boolean extractReplyPayload)
     
    void
    setHandleNotificationStatus(boolean handleNotificationStatus)
    The flag indicating if the adapter should send SubscriptionConfirmation/UnsubscribeConfirmation message to the `output-channel` or not.
    void
     
    void
    setHeaderMapper(org.springframework.integration.mapping.HeaderMapper<HttpHeaders> headerMapper)
     
    void
    setMergeWithDefaultConverters(boolean mergeWithDefaultConverters)
     
    void
     
    void
     
    void
    setPayloadExpression(Expression payloadExpression)
     
    void
    setRequestMapping(org.springframework.integration.http.inbound.RequestMapping requestMapping)
     
    void
    setRequestPayloadTypeClass(Class<?> requestPayloadType)
     
    void
    setStatusCodeExpression(Expression statusCodeExpression)
     

    Methods inherited from class org.springframework.integration.http.inbound.HttpRequestHandlingMessagingGateway

    handleRequest, setConvertExceptions

    Methods inherited from class org.springframework.integration.http.inbound.HttpRequestHandlingEndpointSupport

    doHandleRequest, extractRequestBody, getMessageConverters, prepareRequest, prepareRequestEntity, setStatusCodeIfNeeded, setupResponseAndConvertReply

    Methods inherited from class org.springframework.integration.http.inbound.BaseHttpInboundEndpoint

    afterShutdown, beforeShutdown, createEvaluationContext, evaluateHttpStatus, getCrossOrigin, getExtractReplyPayload, getHeaderExpressions, getHeaderMapper, getIntegrationPatternType, getPayloadExpression, getRequestMapping, getRequestPayloadType, getStatusCodeExpression, getValidator, isExpectReply, isReadable, resolveHttpStatusFromHeaders, setCrossOrigin, setRequestPayloadType, setStatusCodeExpressionString, setValidator, validate

    Methods inherited from class org.springframework.integration.gateway.MessagingGatewaySupport

    buildErrorMessage, buildSendTimer, destroy, doStart, doStop, getErrorChannel, getErrorMessageAttributes, getErrorMessageStrategy, getManagedName, getManagedType, getOverrides, getReplyChannel, getRequestChannel, isLoggingEnabled, isObserved, receive, receive, receiveMessage, receiveMessage, registerMetricsCaptor, registerObservationRegistry, registerReplyMessageCorrelatorIfNecessary, sendAndReceive, sendAndReceiveMessage, sendAndReceiveMessageReactive, sendTimer, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setErrorOnTimeout, setLoggingEnabled, setManagedName, setManagedType, setObservationConvention, setReceiverObservationConvention, setReplyChannel, setReplyChannelName, setReplyMapper, setReplyTimeout, setRequestChannel, setRequestChannelName, setRequestMapper, setRequestTimeout, setShouldTrack

    Methods inherited from class org.springframework.integration.endpoint.AbstractEndpoint

    doStop, getPhase, getRole, isActive, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stop

    Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport

    afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentDescription, getComponentName, getComponentSource, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentDescription, setComponentName, setComponentSource, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.springframework.integration.support.management.IntegrationManagement

    getThisAs

    Methods inherited from interface org.springframework.integration.support.context.NamedComponent

    getBeanName, getComponentName

    Methods inherited from interface org.springframework.context.SmartLifecycle

    isPauseable
  • Constructor Details

    • LegacyJackson2SnsInboundChannelAdapter

      public LegacyJackson2SnsInboundChannelAdapter(software.amazon.awssdk.services.sns.SnsClient amazonSns, String... path)
  • Method Details

    • setHandleNotificationStatus

      public void setHandleNotificationStatus(boolean handleNotificationStatus)
      The flag indicating if the adapter should send SubscriptionConfirmation/UnsubscribeConfirmation message to the `output-channel` or not.
      Parameters:
      handleNotificationStatus - the flag to set. Default is false.
    • onInit

      protected void onInit()
      Overrides:
      onInit in class org.springframework.integration.http.inbound.HttpRequestHandlingEndpointSupport
    • getComponentType

      public String getComponentType()
      Specified by:
      getComponentType in interface org.springframework.integration.support.context.NamedComponent
      Overrides:
      getComponentType in class org.springframework.integration.http.inbound.BaseHttpInboundEndpoint
    • send

      protected void send(Object object)
      Overrides:
      send in class org.springframework.integration.gateway.MessagingGatewaySupport
    • setPayloadExpression

      public void setPayloadExpression(Expression payloadExpression)
      Overrides:
      setPayloadExpression in class org.springframework.integration.http.inbound.BaseHttpInboundEndpoint
    • setHeaderExpressions

      public void setHeaderExpressions(Map<String,Expression> headerExpressions)
      Overrides:
      setHeaderExpressions in class org.springframework.integration.http.inbound.BaseHttpInboundEndpoint
    • setMessageConverters

      public void setMessageConverters(List<HttpMessageConverter<?>> messageConverters)
      Overrides:
      setMessageConverters in class org.springframework.integration.http.inbound.HttpRequestHandlingEndpointSupport
    • setMergeWithDefaultConverters

      public void setMergeWithDefaultConverters(boolean mergeWithDefaultConverters)
      Overrides:
      setMergeWithDefaultConverters in class org.springframework.integration.http.inbound.HttpRequestHandlingEndpointSupport
    • setHeaderMapper

      public void setHeaderMapper(org.springframework.integration.mapping.HeaderMapper<HttpHeaders> headerMapper)
      Overrides:
      setHeaderMapper in class org.springframework.integration.http.inbound.BaseHttpInboundEndpoint
    • setRequestMapping

      public void setRequestMapping(org.springframework.integration.http.inbound.RequestMapping requestMapping)
      Overrides:
      setRequestMapping in class org.springframework.integration.http.inbound.BaseHttpInboundEndpoint
    • setRequestPayloadTypeClass

      public void setRequestPayloadTypeClass(Class<?> requestPayloadType)
      Overrides:
      setRequestPayloadTypeClass in class org.springframework.integration.http.inbound.BaseHttpInboundEndpoint
    • setExtractReplyPayload

      public void setExtractReplyPayload(boolean extractReplyPayload)
      Overrides:
      setExtractReplyPayload in class org.springframework.integration.http.inbound.BaseHttpInboundEndpoint
    • setMultipartResolver

      public void setMultipartResolver(MultipartResolver multipartResolver)
      Overrides:
      setMultipartResolver in class org.springframework.integration.http.inbound.HttpRequestHandlingEndpointSupport
    • setStatusCodeExpression

      public void setStatusCodeExpression(Expression statusCodeExpression)
      Overrides:
      setStatusCodeExpression in class org.springframework.integration.http.inbound.BaseHttpInboundEndpoint