The Talon Manual

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
// Create an embedded entity. This can be done at application
// startup to prevent allocation at runtime. 
MyEmbeddedEntity entityCopy = MyEmbeddedEntity.create();
.
.
.
if(message.hasMyEntity()) {
  message.copyMyEntityTogetMyEntityTo(entityCopy);
}
.
.
.

// At some later date, dispose of the embedded entity.
// It will be returned to the global pool.  
entityCopy.dispose();

...

Note that backing buffers are sourced from buffer pools managed by the platform ... the actual size of the buffer allocated will be a power of 2. Therefore applications should use a power of 2 when specifying the backing buffer size. 

When an embedded entity is deserialized or copied to another embedded entity with an insufficient backing buffer size, the inadequate buffer is disposed back to its pool and a new backing buffer is created. 

 

Pass-through

...

Fields 
Anchor
PassThroughFields
PassThroughFields

 

 

Xbuf supports the ability for an application to preserve fields received on the wire that are not defined in the ADM model that generated them. These fields are referred to as pass-through fields and they are preserved by in the backing buffer of the embedded entity in their serialized protobuf wire format. Because the backing buffer stores the fields in protobuf wire format it is event possible to serialize and deserialize between different embedded field types that share the same field ids and types. These are called pass-through fields because an intermediate app that receives fields it doesn't recognize can pass them between a sender and receiver application without them being lost. 

...

  • Taken from inbound to outbound message using take e.g:

    Code Block
    languagejava
    OutboundMessage.setEmbeddedEntity(inboundMessage.takeEmbeddedEntity());
  • When an embedded entity is deserialized from another embedded entity:

    Code Block
    languagejava
    EmbeddedEntity.deserializeFrom(embeddedEntity.serializeToByteBuffer());
  • When an embedded entity is copied from another embedded entity:

    Code Block
    languagejava
    EmbeddedEntity copy = EmbeddedEntity.copy();
    //or
    message.getEmbeddedEntityTo(copy);

...

  •  

Pass through fields are not preserved when:

...