Interface CodecProvider
- All Known Implementing Classes:
BuiltInCodecProviders.Bytes,BuiltInCodecProviders.Text,JsonCodecProvider,TomlCodecProvider,XmlCodecProvider,YamlCodecProvider
Discovered with ServiceLoader, the same way transports are. That is what
lets asXml() exist in the core without the core depending on an XML library: the method
asks for a codec called xml, and either the module providing it is on the classpath or
the error says which artifact to add.
To add a format, implement this and Codec, and name the implementation in
META-INF/services/org.acemq.amqp.api.CodecProvider.
-
Method Summary
-
Method Details
-
name
String name()- Returns:
- the short name this format is asked for by, such as
jsonorxml; lowercase, no spaces
-
create
Codec create()- Returns:
- a codec for this format
- Throws:
AceMqException- if the format's library is missing or misconfigured
-
order
default int order()Where this codec sits when several could read the same message.A consumer reads with every codec on the classpath, tried in this order, because a message whose sender set no content type has told us nothing and something usually still reads it. Lower numbers are tried first. Formats that recognise their own bytes belong near the front; a format that accepts anything belongs at the back, or it will answer for messages that were not meant for it.
- Returns:
- the sort key;
500is a reasonable default for a new format
-