Package org.acemq.amqp.api
Class SchemaDefinition
java.lang.Object
org.acemq.amqp.api.SchemaDefinition
A schema as a registry sees it: some text, and enough about it to know what the text is.
Deliberately not an Avro type, a Protobuf descriptor or a JSON Schema object. A registry that speaks one serialisation format is a registry that has to be rebuilt for the next one, and the same schemas will need to be reachable from MQTT and STOMP as much as from AMQP. The format is a label; the definition is text; parsing is the codec's business.
The fingerprint is what makes registration idempotent. Registering the same schema twice must return the same identifier however many processes do it and in whatever order, so the question "have I seen this before?" is asked of the content rather than of a name somebody chose.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
SchemaDefinition
- Parameters:
format- serialisation format this schema is written in, such asavro,protobuforjsonschemasubject- what the schema describes, normally the fully qualified type namedefinition- the schema itself, as text
-
-
Method Details
-
format
- Returns:
- the serialisation format, lowercase
-
subject
- Returns:
- what the schema describes
-
definition
- Returns:
- the schema text
-
fingerprint
- Returns:
- a hex SHA-256 over the format and the definition. Two definitions differing only in whitespace fingerprint differently, which is deliberate: canonicalising is format-specific and belongs to whoever understands the format
-
equals
-
hashCode
public int hashCode() -
toString
-