Annotation Type MatsEndpointSetup


  • @Documented
    @Retention(RUNTIME)
    @Target({METHOD,ANNOTATION_TYPE})
    @Repeatable(MatsEndpointSetups.class)
    public @interface MatsEndpointSetup
    NOTE: You should probably use MatsClassMapping or @MatsMapping instead - or otherwise consider plain programmatic registration instead of using this feature as it brings very little convenience compared to pure Java.

    A method annotated with this repeatable annotation specifies a method that shall set up a Multi-Staged Mats Endpoint. Note that as opposed to @MatsMapping and MatsClassMapping, this method will be invoked once at startup to set up the endpoint, and will not be invoked each time when the Mats endpoint gets a message (as is the case with @MatsMapping and @MatsClassMapping).

    You specify the EndpointId, state STO type and the reply DTO type using annotation parameters. The method is then invoked once during Spring context startup, with a MatsEndpoint instance as argument, as would have been returned by matsFactory.staged(...) when using programmatic registration. The method should then invoke endpoint.stage(..) and endpoint.lastStage(..) to set up the MatsEndpoint - as you would have done when using programmatic registration. You can also have an argument of type EndpointConfig to be able to configure the endpoint - but you can also do this using the config getters on the endpoint instance, and for each stage you create (e.g. to set concurrency). Remember again that this is a setup method where you should set up the endpoint, and it is invoked only once during startup, and then never again.

    In a multi-MatsFactory setup, you may qualify which MatsFactory this Endpoint should be constructed on - read JavaDoc on @MatsMapping for how this works.

    See Also:
    MatsMapping, MatsClassMapping
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      java.lang.String endpointId
      The Mats Endpoint Id that this endpoint should listen to.
      java.lang.String matsFactoryBeanName
      Specified the MatsFactory to use by means of specifying the bean name of the MatsFactory.
      java.lang.Class<? extends java.lang.annotation.Annotation> matsFactoryCustomQualifierType
      Specifies the MatsFactory to use by means of a specific qualifier annotation type (which thus must be meta-annotated with Qualifier).
      java.lang.String matsFactoryQualifierValue
      Specified the MatsFactory to use by means of specifying the @Qualifier value.
      java.lang.Class<?> reply
      The Mats Data Transfer Object class that will be returned by the last stage of the staged endpoint.
      java.lang.Class<?> state
      The Mats State Transfer Object class that should be employed for all of the stages for this endpoint.
      java.lang.String value
      Alias for "endpointId", so that if you only need to set the endpointId, you can do so directly: @MatsEndpointSetup("endpointId")
    • Element Detail

      • endpointId

        @AliasFor("value")
        java.lang.String endpointId
        The Mats Endpoint Id that this endpoint should listen to.
        Returns:
        the Mats Endpoint Id which this endpoint listens to.
        Default:
        ""
      • value

        @AliasFor("endpointId")
        java.lang.String value
        Alias for "endpointId", so that if you only need to set the endpointId, you can do so directly: @MatsEndpointSetup("endpointId")
        Returns:
        the endpointId.
        Default:
        ""
      • state

        java.lang.Class<?> state
        The Mats State Transfer Object class that should be employed for all of the stages for this endpoint.
        Returns:
        the State Transfer Object class that should be employed for all of the stages for this endpoint.
        Default:
        void.class
      • reply

        java.lang.Class<?> reply
        The Mats Data Transfer Object class that will be returned by the last stage of the staged endpoint.
        Returns:
        the Data Transfer Object class that will be returned by the last stage of the staged endpoint.
        Default:
        void.class
      • matsFactoryCustomQualifierType

        java.lang.Class<? extends java.lang.annotation.Annotation> matsFactoryCustomQualifierType
        Specifies the MatsFactory to use by means of a specific qualifier annotation type (which thus must be meta-annotated with Qualifier). Notice that this will search for the custom qualifier annotation type, as opposed to if you add the annotation to the @MatsEndpointSetup-annotated method directly, in which case it "equals" the annotation instance (as Spring also does when performing injection with such qualifiers). The difference comes into play if the annotation has values, where e.g. a @SpecialMatsFactory(location="central") is not equal to @SpecialMatsFactory(location="region_west") - but they are equal when comparing types, as the qualification here does. Thus, if using this qualifier-approach, you should probably not use values on your custom qualifier annotations (instead make separate custom qualifier annotations, e.g. @MatsFactoryCentral and @MatsFactoryRegionWest for the example).
        Returns:
        the custom qualifier type which the wanted MatsFactory is qualified with.
        Default:
        java.lang.annotation.Annotation.class
      • matsFactoryQualifierValue

        java.lang.String matsFactoryQualifierValue
        Specified the MatsFactory to use by means of specifying the @Qualifier value. Spring performs such lookup by first looking for actual qualifiers with the specified value, e.g. @Qualifier(value="the_value"). If this does not produce a result, it will try to find a bean with this value as the bean name.
        Returns:
        the qualifier value which the wanted MatsFactory is qualified with.
        Default:
        ""
      • matsFactoryBeanName

        java.lang.String matsFactoryBeanName
        Specified the MatsFactory to use by means of specifying the bean name of the MatsFactory.
        Returns:
        the bean name of the wanted MatsFactory.
        Default:
        ""