All Classes and Interfaces
Class
Description
Base class containing common code for Rule_Mats and Extension_Mats located in the following modules:
mats-test-junit
mats-test-jupiter
This class sets up an in-vm Active MQ broker through the use of
MatsTestBroker which is again utilized to
create the MatsFactory which can be utilized to create unit tests which rely on testing functionality
utilizing MATS.Common base class which consolidates the common logic utilized by both Rule_MatsEndpoint and Extension_MatsEndpoint.
Common part of the interface of
MatsInitiateInterceptor.InitiateCompletedContext and MatsStageInterceptor.StageCompletedContext.Common elements of intercepting messages for both Initiate and Stage.
A simple convenience replacement for @ComponentScan which excludes any configuration classes employing the special
@ConfigurationForTest annotation instead of the standard @Configuration
annotation.Configurable
ScenarioConnectionFactoryWrapper.ScenarioDecider, whose defaults implements the logic described in
ScenarioConnectionFactoryProducer and handles all the Spring Profiles specified in MatsProfiles.An implementation of this interface can decide whether a specific Mats Scenario is active.
Standard implementation of
ConfigurableScenarioDecider.SpecificScenarioDecider used in the default configuration of
ConfigurableScenarioDecider, which takes a set of profile-or-properties names and checks whether they are
present as a Spring Profile, or (with the "-" replaced by ".") whether it exists as a property in the Spring
Environment.An "alias" for the @Configuration annotation which is meant to be used on tests' configuration classes - which then
is excluded from component scanning if the component scan is using
ComponentScanExcludingConfigurationForTest
instead of the ordinary ComponentScan.A abstract
ConnectionFactoryWrapper recognized by ScenarioConnectionFactoryProducer, which has a
start() and stop() method, which can be used if you need to fire up a local MQ Broker: This class is meant to be
extended to provide such functionality.A base Wrapper for a JMS
ConnectionFactory, which simply implements ConnectionFactory, takes a
ConnectionFactory instance and forwards all calls to that.A base Wrapper for a JDBC
DataSource, which simply implements DataSource, takes a DataSource instance and
forwards all calls to that.DataSource wrapper which returns thin Connection proxies (currently employing Java's "dynamic proxy" functionality)
which do not actually fetch a Connection until it is needed.
Provides a method to query whether the Connection actually was gotten.
Specifies that the annotated method parameter is an incoming Data Transfer Object.
Enables Mats "SpringConfig", which is bean-scanning for methods on Spring beans annotated with
MatsMapping,
MatsClassMapping and MatsEndpointSetup, conceptually inspired by the @EnableWebMvc
annotation.Provides a full MATS harness for unit testing by creating
MatsFactory utilizing an in-vm
Active MQ broker, and optionally a TestH2DataSource for database tests.Extension to create a single staged endpoint whose reply/processor can be changed throughout its life, i.e.
Similar to
Extension_Mats, provides a full MATS harness for unit testing by creating MatsFactory utilizing an in-vm Active MQ broker.The JMS implementation of
MatsEndpoint.Base class for Exceptions thrown around in the JMS implementation of Mats.
Thrown if anything goes haywire with the backend implementation, e.g.
If we get "stack overflow" or "call overflow", then the sending method will throw this.
Thrown if a undeclared checked exception propagates out of the user-supplied lambda.
This is an internal context object, for execution of initiations and stage processing in JMS-Mats - one instance is
made per initiation and per message reception.
Interface for implementing JMS Connection and JMS Session handling.
Pooling implementation of
JmsMatsJmsSessionHandler - upon
creation, you decide how
Connections are shared for JmsMatsStageProcessors and MatsInitiators.What kind of sharing of JMS Connections to employ for a
JmsMatsInitiator.What kind of sharing of JMS Connections to employ for a
JmsMatsStageProcessor.A dead simple implementation of
JmsMatsJmsSessionHandler which does nothing of pooling nor connection
sharing.A "sidecar object" for the JMS Session, so that additional stuff can be bound to it.
Holds the entire contents of a "Mats Message" - so that it can be sent later.
Some small specifics for the underlying JMS Implementation.
The JMS Mats implementation of
MatsEndpoint.ProcessContext.The JMS implementation of
MatsStage.Common "static" stash, hacked up as an interface to be implemented if you need it.
Transactional aspects of the JMS Mats implementation.
Implementation of
JmsMatsTransactionManager handling only JMS (getting Connections, and creating Sessions),
doing all transactional handling "native", i.e.The
JmsMatsTransactionManager.TransactionContext implementation for
JmsMatsTransactionManager_Jms.Implementation of
JmsMatsTransactionManager that in addition to the JMS transaction also handles a JDBC SQL
Connection (using only pure java, i.e.The
JmsMatsTransactionManager.TransactionContext-implementation for JmsMatsTransactionManager_Jms.Raised if commit or rollback of the SQL Connection failed.
Implementation of
JmsMatsTransactionManager that in addition to the JMS transaction keeps a Spring
PlatformTransactionManager employing a JDBC DataSource for which it keeps transaction demarcation along with
the JMS transaction, by means of "Best Effort 1 Phase Commit".Extension of
DeferredConnectionProxyDataSourceWrapper which implements InfrastructureProxy.Provided to
getTransactionContext(...) when a Mats-component
fetches the TransactionContext implementation.The lambda that is provided to the
JmsMatsTransactionManager for it to provide transactional demarcation
around.Implementors shall do the transactional processing and handle any Throwable that comes out of the
JmsMatsTransactionManager.ProcessingLambda by rolling back.Will produce an "embeddable" HTML interface - notice that there are CSS (
LocalHtmlInspectForMatsFactory.getStyleSheet(Appendable)),
JavaScript (LocalHtmlInspectForMatsFactory.getJavaScript(Appendable)) and HTML
(createFactoryReport(Appendable,..)) to include.Implementation of
LocalHtmlInspectForMatsFactory.Interceptor that collects "local stats" for Initiators and Stages of Endpoints, which can be used in conjunction with
a MatsFactory report generator,
LocalHtmlInspectForMatsFactory.A class annotated with this repeatable annotation will become a Mats Endpoint, where an instance of the class itself
is the State (STO) object for the Endpoint, and each @
Stage-annotated method on the class is a stage of
the Endpoint.Each method in the class that shall correspond to a Stage on the Mats endpoint must be annotated with this
@Stage annotation.All of
MatsFactory, MatsEndpoint and MatsStage have some configurable elements, provided by a
config instance, this is the top of that hierarchy.Represents a Mats Endpoint - you create instances from the
MatsFactory (or use the Spring integration).The part of
MatsEndpoint.ProcessContext that exposes the "getter" side of the context, which enables it to be exposed
outside of the process lambda.Provides for both configuring the endpoint (before it is started), and introspecting the configuration.
For the incoming message type, this represents the equivalent of Java's
Object - a "generic" incoming
message whose type is not yet determined.Can be thrown by the
MatsEndpoint.ProcessLambda of the MatsStages to denote that it would prefer this message
to be instantly put on a Dead Letter Queue (the stage processing, including any database actions, will
still be rolled back as with any other exception thrown out of a ProcessLambda).A way for the process stage to communicate with the library, providing methods to invoke a request, send a reply
(for multi-stage endpoints, this provides a way to do a "early return"), initiate a new message etc.
A base Wrapper for
MatsEndpoint.ProcessContext, which simply implements ProcessContext, takes a ProcessContext
instance and forwards all calls to that.The lambda that shall be provided by the developer for the process stage(s) for the endpoint - provides the
context, state and incoming message DTO.
Specialization of
ProcessLambda that makes it possible to do a "return
replyDto" at the end of the stage, which is just a convenient way to invoke
MatsEndpoint.ProcessContext.reply(Object).Specialization of
ProcessLambda which does not have a state, and have the same
return-semantics as ProcessReturnLambda - used for single-stage
endpoints as these does not have multiple stages to transfer state between.Specialization of
ProcessLambda which does not have reply specified - used for
terminator endpoints.A method annotated with this repeatable annotation specifies a method that shall set up a (usually)
Multi-Staged Mats Endpoint.
The start point for all interaction with Mats - you need to get hold of an instance of this interface to be able to
code and configure Mats endpoints, and to perform
initiations like sending a message,
perform a request and publish a message.Provides ThreadLocal access to attributes from the
MatsInitiator.MatsInitiate initiate context and MatsStage
process context - currently MatsFactory.ContextLocal.getAttribute(Class, String...), which can provide you with the
transactionally demarcated SQL Connection if the Mats implementation provides such.Provides for a way to configure factory-wide elements and defaults.
A base Wrapper for
MatsFactory, which simply implements MatsFactory, takes a MatsFactory instance and
forwards all calls to that.Base Wrapper interface which Mats-specific Wrappers implements, defining four "wrappee" methods.
An instance of this class acts as a bridge service between the synchronous world of e.g.
This exception is raised through the
CompletableFuture if the timeout specified when getting the
CompletableFuture is reached (to get yourself a future, use one of the
futurizeXYZ(..) methods).An instance of this class will be the return value of any
CompletableFutures created with the
MatsFuturizer.Implement this interface to intercept Initiations, then register with
MatsInterceptable.addInitiationInterceptor(MatsInitiateInterceptor).While still within the initiation context, this interception enables modifying outgoing messages from the user
lambda, setting trace properties, adding "sideloads", deleting a message, or initiating additional messages.
Enables the intercepting of the invocation of the user lambda in an Initiation, with ability to wrap the
MatsInitiator.MatsInitiate (and thus modify any request, send or publishes) - or even take over the entire initiation.Provides the means to get hold of a
MatsInitiator.MatsInitiate instance for initiating Mats message flows: You fetch an
instance implementing this interface using typically MatsFactory.getDefaultInitiator(), and then invoke
MatsInitiator.initiate(InitiateLambda), where the lambda will provide you with the necessary MatsInitiator.MatsInitiate instance
on which you have methods to construct and dispatch e.g.@FunctionalInterface for the "initiate lambda" - what you supply to the
initiate method.A hint to the underlying implementation of how much historic debugging information for the call flow should be
retained in the underlying protocol.
Will be thrown by the
MatsInitiator.initiate(InitiateLambda)-method if it is not possible at this time to
establish a connection to the underlying messaging system (e.g.Unchecked variant of the
MatsInitiator.MatsBackendException, thrown from the MatsInitiator.initiateUnchecked(InitiateLambda)
variant of initiate().An implementation of this interface is given to you when you want to initiate a new Mats Flow.
A base Wrapper for
MatsInitiator.MatsInitiate, which simply implements MatsInitiate, takes a MatsInitiate instance and
forwards all calls to that.Will be thrown by the
MatsInitiator.initiate(InitiateLambda)-method if Mats fails to send the messages
after the MatsInitiator.InitiateLambda has been run, any external resource (typically DB) has been committed, and
then some situation occurs that makes it impossible to send out messages.Unchecked variant of the
MatsInitiator.MatsMessageSendException, thrown from the
MatsInitiator.initiateUnchecked(InitiateLambda) variant of initiate().Reference information about the outgoing message.
Specifies methods that an interceptable MatsFactory must provide.
Marker interface to denote a logging interceptor.
Marker interface to denote a metrics interceptor.
Combines the interfaces
MatsInterceptable and MatsFactory.A method annotated with this repeatable annotation directly becomes a
Mats Single-stage
Endpoint or a
Mats
Terminator Endpoint, depending on whether the method specifies a return type, or is void.A logging interceptor that writes loglines to two SLF4J loggers, including multiple pieces of information on the MDC
(initiatorId, endpointId and stageIds, and timings and sizes), so that it hopefully is easy to reason about and debug
all Mats flows, and to be able to use the logging system (e.g.
An interceptor that instruments a MatsFactory with metrics using the (Spring) Micrometer framework.
A
MeterFilter that applies a hopefully reasonable histogram to all timing meters.Represents an Outgoing Mats Message.
Specifies Spring Profiles (and also which Spring Environment variables) that are relevant for Mats when used with
conjunction with
ScenarioConnectionFactoryProducer and the default configuration of
ConfigurableScenarioDecider.The three different Mats Scenarios that the
ScenarioConnectionFactoryWrapper juggles between based on the
results of a set of three ScenarioConnectionFactoryWrapper.ScenarioDeciders, with an optional default choice.Defines the operations needed serialize and deserialize
MatsTraces to and from byte arrays (e.g.The methods in this interface shall throw this RuntimeException if they encounter problems.
Implementation of
MatsSerializer that employs Jackson JSON
library for serialization and deserialization, and compress and decompress using Deflater and
Inflater.The
BeanPostProcessor-class specified by the @EnableMats annotation.Thrown if the setup of a Mats Spring endpoint fails.
Thrown if the invocation of a
@MatsMapping or @MatsEndpointSetup
annotated method raises InvocationTargetException and the underlying exception is not a
RuntimeException.A representation of a process stage of a
MatsEndpoint.Provides for both configuring the stage (before it is started), and introspecting the configuration.
Implement this interface to intercept Stage Processing, then register with
MatsInterceptable.addStageInterceptor(MatsStageInterceptor).While still within the stage process context, this interception enables modifying outgoing messages from the user
lambda, setting trace properties, adding "sideloads", deleting a message, or initiating additional messages.
Enables the intercepting of the invocation of the "user lambda" in a Stage, with ability to wrap the
MatsEndpoint.ProcessContext (and thus modify any reply, request, next or initiations) and/or modifying state and
message - or even take over the entire stage.Common context elements for stage interception, including all the incoming message/envelope data and metadata.
The main result of the Stage Processing - if the stage also initiated messages, this will be known by
MatsStageInterceptor.StageCompletedContext.getStageInitiatedMessages() being non-empty.A special utility class utilized in tests and Mats test infrastructure providing a ConnectionFactory for the test
(Jms)MatsFactory - and if relevant also fires up an embedded ("in-VM") ActiveMQ (default) or Artemis message broker.
Feature flags for the method
MatsTestBroker.newActiveMqBroker(ActiveMq...) - which you probably shouldn't do unless you
are experimenting with the "mats-examples".Either creates an in-vm ActiveMQ, or an ActiveMQ ConnectionFactory to an external URL, based on system
properties.
Creates a connection to an Artemis broker.
Creates an in-vm ActiveMQ no matter what the properties says.
Tool that makes it possible to query the underlying broker of a test MatsFactory for messages, in particular
"residual" messages and DLQs.
Representation of the Mats message that sat on the DLQ.
One-stop-shop for making simple Spring-based integration/unit tests of Mats endpoints (NOT utilizing SQL
Connections), automatically importing the configuration .
The reason for this obscure way to add the
MatsTestInfrastructureConfiguration (as opposed to just point
to it with "classes=..") is as follows: Spring's testing integration has this feature where any static
inner @Configuration class of the test class is automatically loaded.Same as
MatsTestContext, but includes a H2 DataSource, as configured by
MatsTestInfrastructureDbConfiguration.The reason for this obscure way to add the
MatsTestInfrastructureDbConfiguration (as opposed to just
point to it with "classes=..") is as follows: Spring's testing integration has this feature where any static
inner @Configuration class of the test class is automatically loaded.Microscopic helper methods to create Loggers and Ids typically needed when making Mats tests.
Spring
@Configuration class that cooks up the simple test infrastructure, employing a
MatsSerializer from the Spring context if available, otherwise creates a default MatsSerializerJson.Same as
MatsTestInfrastructureConfiguration, but includes a H2 DataSource, as configured by
MatsTestInfrastructureDbConfiguration.MatsTestH2DataSourceConfiguration, which uses the TestH2DataSource.createStandard() convenience
method.Test-utility: Gives a latch-functionality facilitating communication back from typically a Mats Terminator to the
main-thread that sent a message to some processor, and is now waiting for the Terminator to get the result.
The only thing this annotation does, is to meta-annotate the test class with
@ActiveProfiles(MatsProfiles.PROFILE_MATS_TEST).Together with the
MatsSerializer, this interface describes one way to implement a wire-protocol for how Mats
communicates.Represents an entry in the
MatsTrace.Which type of Call this is.
An encapsulation of the stageId/endpointId along with the
MatsTrace.Call.MessagingModel the message should be
delivered over.Specifies what type of Messaging Model a 'to' and 'replyTo' is to go over: Queue or Topic.
Specifies how the MatsTrace will handle historic values that are present just for debugging.
The State instances (of type Z), along with the height of the stack the state relates to.
An implementation of
MatsTrace which uses fields to hold all state necessary for a Mats flow, including
"holders" for the serialization of DTOs and STOs, with type 'Z'.Represents an entry in the
MatsTrace.Extension of
MatsTraceFieldImpl which uses String for Z, meant to use JSON to serialize the DTO and STO
payloads.If you need a random string for a part of the traceId (Read NOTE about traceIds!), use this class instead of
UUID, because UUID has low entropy density with only 4 bits per character, and dashes.ClassRule which provides a full Mats harness for unit testing by creating MatsFactory
utilizing an in-vm Active MQ broker, and optionally a TestH2DataSource for database tests.Rule to create a single staged endpoint whose reply/processor can be changed throughout its life, i.e.
Similar to
Rule_Mats, provides a full Mats harness for unit testing by creating MatsFactory utilizing an in-vm Active MQ broker.Utility class for replacing dodgy characters from queue/topic names, and names in general, in the Message Broker
world - it is quite restrictive, replacing any character not in [a-z,A-Z,0-9,.,_,-] (lower alpha, upper alpha,
digits, dot, underscore, minus/dash) with '_'.
Provides a factory for a Spring-integrated Wrapper/Facade around a JMS ConnectionFactory, which in addition to
supporting the production setup, also facilitates the development situation where you often want to run against
either an in-vm MQ Broker or against a MQ Broker running on localhost, and also integrates with the
"mats-spring-test" integration test library where when run with the
MatsTestProfile you will most
probably want an in-vm setup (typically mocking up the project-external Mats endpoints that the tested endpoints
collaborate with).A
ConnectionFactoryWrapper which lazily decides which of the three MatsScenarios are active, and
produces the wrapper-target ConnectionFactory based on that - you most probably want to use
ScenarioConnectionFactoryProducer to make an instance of this class, but you can configure it directly too.A ConnectionFactory provider which can throw Exceptions - if it returns a
ConnectionFactoryWithStartStopWrapper, start() and stop() will be invoked on that, read more on its
JavaDoc.We need a way to decide between the three different
MatsScenarios.Use this Test Execution Listener to autowire JUnit Rules and Jupiter Extensions, i.e.
This
TestExecutionListener finds all fields in the test class instance which is annotated with JUnit
Rule or JUnit 5 Jupiter RegisterExtension, and runs
beanFactory.autowireBean(fieldValue) on them.Provides an easy way to get hold of the most probable
JmsMatsFactory transaction manager configuration in the
Spring world (using JmsMatsTransactionManager_JmsAndSpringManagedSqlTx, or only the
JmsMatsTransactionManager_Jms if no DataSource is needed).Wrapper that should be used for a JmsMatsFactory in a Spring context.
Specifies that the annotated method parameter is an incoming State Transfer Object.
A wrapped H2 DataBase DataSource which has a couple of extra methods which simplifies testing, in particular the
TestH2DataSource.cleanDatabase(), and TestH2DataSource.createDataTable() method with associated convenience methods for storing and
getting simple values.A
RuntimeException for use in database access methods and tests.A testing-oriented
MatsFactory-provider which utilizes the MatsTestBroker for the produced
MatsFactory to connect to - this is for the scenarios where you do NOT have your test load the entire
application's Spring configuration, but instead "piece together" the relevant Spring
@Components containing test-relevant Mats endpoints and other beans from your application
along with test-specific mocked-out endpoints: You will then probably not have the MatsFactory present in the Spring
context.A small tool to produce a String - specifically an opinionated TraceId.