Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Daniel Zou
    @dzou
    @artembilan - Hey Artem, does Spring Integration have some built-in support for dead letter queues? Pub/sub recently added support for dead letter queues and we were wondering what extension points we could implement to make this feature easier to use in Spring Integration and Spring Cloud Stream
    Artem Bilan
    @artembilan
    Well, Spring Integration is a light-weight messaging framework with some abstractions to adapt target protocols to/from
    And since we are not broker, but library we don't hold a state
    therefore it is incorrect to ask about in-memory DLQ
    This is indeed a target protocol feature like JMS, AMQP or as you have just said Pub/Sub
    Therefore it has to be implemented in those channel adapters
    But generally speaking there is always that errorChannel abstraction which could be used for publishing into the mentioned DLQ.
    In fact we even have that ErrorMessageStrategy to let to build a specific error message which could be used to produce some target protocol even for a DLQ.
    Does it make sense, @dzou ?
    Daniel Zou
    @dzou
    Thanks @artembilan. Ohh interesting... Yes that makes sense. Just trying to understand more about the function of this error channel - So right now the way this feature works is that Pub/Sub will automatically forward messages to the DLQ if the message was not-acknowledged 5 times (can be configured). This means user does not have to write an error channel to publish messages to the DLQ if this is done by Pub/Sub automatically right? Perhaps they only need to configure an error channel to read from the DLQ?
    Artem Bilan
    @artembilan
    Well, you indeed can implement that as a fallback logic in the inbound channel adapter - sending to DLQ natively
    But I don't think an errorChannel should be some how involved here if you don't want to let end-user to do something else before publishing elsewhere
    Well, the more I think what you suggest the more it looks like: or native DLQ or errorChannel
    with the later to be treated as a regular consumer which could publish to Pub/Sub or not
    Daniel Zou
    @dzou
    Hmm I guess the concept of error Channel is confusing me a little now
    Artem Bilan
    @artembilan
    OK. let me show some code then:
    Daniel Zou
    @dzou
    Ah ok sounds good
    Artem Bilan
    @artembilan
    protected void sendMessage(Message<?> messageArg) {
            Message<?> message = messageArg;
            if (message == null) {
                throw new MessagingException("cannot send a null message");
            }
            message = trackMessageIfAny(message);
            try {
                this.messagingTemplate.send(getRequiredOutputChannel(), message);
            }
            catch (RuntimeException ex) {
                if (!sendErrorMessageIfNecessary(message, ex)) {
                    throw ex;
                }
            }
        }
    See that sendErrorMessageIfNecessary()?
    Daniel Zou
    @dzou
    Yes
    Artem Bilan
    @artembilan
    So, if we fail to produce a message to the outputChannel, we try to send it to the errorChannel
    if we haven't sent, we rethrow to the native consumer
    Daniel Zou
    @dzou
    Ah ok I see.
    Artem Bilan
    @artembilan
    and that's already its "native" logic what to do with an exception
    This comes from the MessageProducerSupport
    Daniel Zou
    @dzou
    Ah I see, In that case it seems that the native DLQ and error channel are separate concepts; like it wouldn't make sense to send a message to the native DLQ
    Artem Bilan
    @artembilan
    for the SourcePollingChannelAdapter there is an errorChannel option on the poller configuration
    Yes, we can treat it like that
    or we just implement it as a Binder DQL feature
    Daniel Zou
    @dzou
    I see I see, thanks this clarifies a lot
    Artem Bilan
    @artembilan
    for example there is no DLQ in Kafka or Kinesis
    Daniel Zou
    @dzou
    oh But Kafka and Kinesis have a binder DLQ feature?
    Artem Bilan
    @artembilan
    so, we send to the errorChannel which subscriber is going to produce to some preconfigured destination
    which we agreed to call "DLQ"
    Daniel Zou
    @dzou
    ohh ok I see
    Artem Bilan
    @artembilan
    We kinda emulate DLQ with errorChannel logic :smile:
    Daniel Zou
    @dzou
    Ahhh ok, I get it
    Thanks Artem!
    Mike Eltsufin
    @meltsufin
    So, reading this whole discussion it seems that we shouldn't need to do anything to support the "server-side" DLQ. It basically becomes an alternative to the more custom "client-side" DLQ (i.e. error channel). Is that correct?
    Artem Bilan
    @artembilan
    Yes, because with an errorChannel you have more choice what to do with that exception
    In fact we still support both feature in RabbitMQ binder with its native DLX feature
    (and retry if you wish to configure that: https://www.rabbitmq.com/dlx.html :smile: )
    Spencer Gibb
    @spencergibb
    GCP master has been failing on jenkins for the past few weeks
    [ERROR] Errors: 
    
    [ERROR]   GcpFirestoreEmulatorAutoConfigurationTests.testAutoConfigurationDisabled:65->lambda$testAutoConfigurationDisabled$1:66 » IllegalState
    
    [ERROR]   PubSubChannelAdaptersIntegrationTests.initializePubSubAdmin:100 » IO The Appli...
    2020-04-29 14:53:09.432 [main] WARN  o.s.c.g.c.DefaultCredentialsProvider - No core credentials are set. Service-specific credentials (e.g., spring.cloud.gcp.pubsub.credentials.*) should be used if your app uses services that require credentials.
    java.io.IOException: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.
        at com.google.auth.oauth2.DefaultCredentialsProvider.getDefaultCredentials(DefaultCredentialsProvider.java:134)
        at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:119)
        at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:91)
        at com.google.api.gax.core.GoogleCredentialsProvider.getCredentials(GoogleCredentialsProvider.java:67)
        at org.springframework.cloud.gcp.core.DefaultCredentialsProvider.<init>(DefaultCredentialsProvider.java:110)
        at org.springframework.cloud.gcp.autoconfigure.core.GcpContextAutoConfiguration.googleCredentials(GcpContextAutoConfiguration.java:61)
        at org.springframework.cloud.gcp.autoconfigure.core.GcpContextAutoConfiguration$$EnhancerBySpringCGLIB$$3b4dcd17.CGLIB$googleCredentials$0(<generated>)
        at org.springframework.cloud.gcp.autoconfigure.core.GcpContextAutoConfiguration$$EnhancerBySpringCGLIB$$3b4dcd17$$FastClassBySpringCGLIB$$63237771.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
        at org.springframework.cloud.gcp.autoconfigure.core.GcpContextAutoConfiguration$$EnhancerBySpringCGLIB$$3b4dcd17.googleCredentials(<generated>)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    for both tests
    dmitry-s
    @dmitry-s
    Thanks, we will look into that
    Elena Felder
    @elefeint
    The second one is an integration test. I thought Jenkins only ran unit tests?
    for the first one (testAutoConfigurationDisabled), do you have more of the exception?
    Spencer Gibb
    @spencergibb
    i can get the whole exception
    Spencer Gibb
    @spencergibb
    Stacktrace
    
    java.lang.IllegalStateException: Unstarted application context org.springframework.boot.test.context.assertj.AssertableApplicationContext[startupFailure=org.springframework.beans.factory.BeanCreationException] failed to start
        at org.springframework.cloud.gcp.autoconfigure.firestore.GcpFirestoreEmulatorAutoConfigurationTests.lambda$testAutoConfigurationDisabled$1(GcpFirestoreEmulatorAutoConfigurationTests.java:66)
        at org.springframework.cloud.gcp.autoconfigure.firestore.GcpFirestoreEmulatorAutoConfigurationTests.testAutoConfigurationDisabled(GcpFirestoreEmulatorAutoConfigurationTests.java:65)
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'firestoreGrpcStub' defined in org.springframework.cloud.gcp.autoconfigure.firestore.GcpFirestoreAutoConfiguration$FirestoreReactiveAutoConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.google.firestore.v1.FirestoreGrpc$FirestoreStub]: Factory method 'firestoreGrpcStub' threw exception; nested exception is java.io.IOException: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.
        at org.springframework.cloud.gcp.autoconfigure.firestore.GcpFirestoreEmulatorAutoConfigurationTests.testAutoConfigurationDisabled(GcpFirestoreEmulatorAutoConfigurationTests.java:65)
    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.google.firestore.v1.FirestoreGrpc$FirestoreStub]: Factory method 'firestoreGrpcStub' threw exception; nested exception is java.io.IOException: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.
        at org.springframework.cloud.gcp.autoconfigure.firestore.GcpFirestoreEmulatorAutoConfigurationTests.testAutoConfigurationDisabled(GcpFirestoreEmulatorAutoConfigurationTests.java:65)
    Caused by: java.io.IOException: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.
        at org.springframework.cloud.gcp.autoconfigure.firestore.GcpFirestoreEmulatorAutoConfigurationTests.testAutoConfigurationDisabled(GcpFirestoreEmulatorAutoConfigurationTests.java:65)
    
    Standard Output
    
    2020-04-29 14:53:09.432 [main] WARN  o.s.c.g.c.DefaultCredentialsProvider - No core credentials are set. Service-specific credentials (e.g., spring.cloud.gcp.pubsub.credentials.*) should be used if your app uses services that require credentials.
    java.io.IOException: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.
        at com.google.auth.oauth2.DefaultCredentialsProvider.getDefaultCredentials(DefaultCredentialsProvider.java:134)
        at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:119)
        at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:91)
        at com.google.api.gax.core.GoogleCredentialsProvider.getCredentials(GoogleCredentialsProvider.java:67)
        at org.springframework.cloud.gcp.core.DefaultCredentialsProvide