public static interface MatsFactory.FactoryConfig extends MatsConfig
MatsConfig.StartStoppable
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAppName() |
java.lang.String |
getAppVersion() |
java.lang.String |
getMatsDestinationPrefix() |
java.lang.String |
getMatsImplementationName() |
java.lang.String |
getMatsImplementationVersion() |
java.lang.String |
getMatsTraceKey() |
java.lang.String |
getName() |
java.lang.String |
getNodename()
Returns a node-specific identifier, that is, a name which is different between different instances of the
same app running of different nodes.
|
int |
getNumberOfCpus() |
<T> T |
instantiateNewObject(java.lang.Class<T> type)
This method is only relevant for tooling, and thus "hidden away" in this config class.
|
MatsFactory.FactoryConfig |
setAttribute(java.lang.String key,
java.lang.Object value)
Sets an attribute for this entity (factory, endpoint, stage) - can e.g.
|
MatsFactory.FactoryConfig |
setConcurrency(int concurrency)
Changes the default concurrency of the Factory, or of the endpoint (which defaults to the concurrency of the
MatsFactory ), or of the process stage (which defaults to the concurrency of the MatsEndpoint ). |
MatsFactory.FactoryConfig |
setInitiateTraceIdModifier(java.util.function.Function<java.lang.String,java.lang.String> modifier)
Sets a Function that may modify the TraceId of Mats flows that are initiated "from the outside", i.e.
|
MatsFactory.FactoryConfig |
setInteractiveConcurrency(int concurrency)
Like
MatsConfig.setConcurrency(int) , but changes the "interactive concurrency" specifically - this is relevant for
the Mats Flows that are initiated with the interactive flag set. |
MatsFactory.FactoryConfig |
setMatsDestinationPrefix(java.lang.String prefix)
Sets the prefix that should be applied to the endpointIds to get queue or topic name in the underlying
messaging system - the default is
"mats." . |
MatsFactory.FactoryConfig |
setMatsTraceKey(java.lang.String key)
Sets the key name on which to store the "wire representation" of the Mats message if the underlying mechanism
uses some kind of Map - the default is
"mats:trace" . |
MatsFactory.FactoryConfig |
setName(java.lang.String name)
Sets the name of the MatsFactory, default is "" (empty string).
|
MatsFactory.FactoryConfig |
setNodename(java.lang.String nodename)
Sets the nodename that
getNodename() should return. |
getAttribute, getConcurrency, getInteractiveConcurrency, isConcurrencyDefault, isInteractiveConcurrencyDefault, isRunning
MatsFactory.FactoryConfig setName(java.lang.String name)
name
- the name that the MatsFactory should have.java.lang.String getName()
setName(String)
, shall return "" (empty string) if
not set, never null
.int getNumberOfCpus()
Runtime.getRuntime().availableProcessors()
. Implementations
should honor the System Property "mats.cpus" and let that override this number, e.g. "-Dmats.cpus=8"
on command line.MatsFactory.FactoryConfig setInitiateTraceIdModifier(java.util.function.Function<java.lang.String,java.lang.String> modifier)
MatsInitiator.MatsInitiate.traceId(CharSequence)
, and should return a fully formed TraceId that should be used
instead. Needless to say, it should never throw, and if it doesn't have any contextual id to prefix with, it
should return whatever that was passed into it.modifier
- the function that accepts the TraceId that the Mats flow is initiated with, and returns the
TraceId that the Mats flow should actually get.this
for chaining.MatsFactory.FactoryConfig setMatsDestinationPrefix(java.lang.String prefix)
"mats."
. Needless to say, two MatsFactories which are
configured differently here will not be able to communicate. Do not change this unless you have a
compelling reason to why, as you then stray away from the standard, and it will be harder to later merge
two setups.prefix
- the prefix that should be applied to the endpointIds to get queue or topic name in the underlying
messaging system. Default is "mats."
.this
for chaining.java.lang.String getMatsDestinationPrefix()
"mats."
.MatsFactory.FactoryConfig setMatsTraceKey(java.lang.String key)
"mats:trace"
. (The JMS Implementation uses a JMS
MapMessage, and this is the key). Needless to say, two MatsFactories which are configured differently here
will not be able to communicate. Do not change this unless you have a compelling reason to why, as you
then stray away from the standard, and it will be harder to later merge two setups.key
- the key name on which to store the "wire representation" of the Mats message if the underlying
mechanism uses some kind of Map. Default is "mats:trace"
.this
for chaining.java.lang.String getMatsTraceKey()
"mats:trace"
.java.lang.String getAppName()
java.lang.String getAppVersion()
MatsFactory.FactoryConfig setNodename(java.lang.String nodename)
getNodename()
should return. This is not necessary if the current hosts's
hostname is a good enough nodename (which it in a normal production system should be, both running on iron,
VMs and containers like Docker or Kubernetes), as that is what is returned by the getter by default. Must be
set before anything that depends on the return value of getNodename()
is started, i.e. right away
after having created the MatsFactory instance.nodename
- the nodename that this MatsFactory should report from getNodename()
.this
for chaining.java.lang.String getNodename()
java.lang.String getMatsImplementationName()
java.lang.String getMatsImplementationVersion()
<T> T instantiateNewObject(java.lang.Class<T> type)
@MatsClassMapping
).T
- the type of the Class.type
- the Class that should be instantiated.java.lang.RuntimeException
- if the class could not be instantiated (e.g. lacking no-args constructor which can be an issue
depending on the serialization mechanism).MatsFactory.FactoryConfig setAttribute(java.lang.String key, java.lang.Object value)
MatsConfig
null
, the mapping for the specified key is cleared.setAttribute
in interface MatsConfig
key
- the key name for this attribute. Not null
.value
- the value for this attribute. If the value is null
, the mapping for the specified key is
cleared.MatsFactory.FactoryConfig setConcurrency(int concurrency)
MatsConfig
MatsFactory
), or of the process stage (which defaults to the concurrency of the MatsEndpoint
).
Will only have effect before the MatsStage
is started. Can be reset by stopping, setting, and restarting.
Setting to 0 will invoke default logic.setConcurrency
in interface MatsConfig
concurrency
- the concurrency for the Factory, or Endpoint, or Stage. If set to 0, default-logic is in effect.MatsConfig.getConcurrency()
MatsFactory.FactoryConfig setInteractiveConcurrency(int concurrency)
MatsConfig
MatsConfig.setConcurrency(int)
, but changes the "interactive concurrency" specifically - this is relevant for
the Mats Flows that are initiated with the interactive
flag set.setInteractiveConcurrency
in interface MatsConfig
concurrency
- the interactive concurrency for the Factory, or Endpoint, or Stage. If set to 0, default-logic is in
effect.MatsConfig.getInteractiveConcurrency()