6.4. Custom Externalizer ID Values
Advanced externalizers can be assigned custom IDs if desired. Some ID ranges are reserved for other modules or frameworks and must be avoided:
ID Range | Reserved For |
---|---|
1000-1099 | The Infinispan Tree Module |
1100-1199 | Red Hat JBoss Data Grid Server modules |
1200-1299 | Hibernate Infinispan Second Level Cache |
1300-1399 | JBoss Data Grid Lucene Directory |
1400-1499 | Hibernate OGM |
1500-1599 | Hibernate Search/Infinispan Query |
6.4.1. Customize the Externalizer ID (Declaratively)
Customize the advanced externalizer ID declaratively (via XML) as follows:
Procedure 6.2. Customizing the Externalizer ID (Declaratively)
- Add the
global
element to theinfinispan
element:<infinispan> <global /> </infinispan>
- Add the
serialization
element to theglobal
element as follows:<infinispan> <global> <serialization /> </global> </infinispan>
- Add the
advancedExternalizer
element to add information about the new advanced externalizer as follows:<infinispan> <global> <serialization> <advancedExternalizer /> </serialization> </global> </infinispan>
- Define the externalizer ID using the
id
attribute as follows:<infinispan> <global> <serialization> <advancedExternalizers> <advancedExternalizer id="$ID" /> </advancedExternalizers> </serialization> </global> </infinispan>
Ensure that the selected ID is not from the range of IDs reserved for other modules. - Define the externalizer class using the
externalizerClass
attribute as follows:<infinispan> <global> <serialization> <advancedExternalizers> <advancedExternalizer id="$ID" externalizerClass="org.infinispan.marshall.AdvancedExternalizerTest$IdViaConfigObj$Externalizer"/> </advancedExternalizers> </serialization> </global> </infinispan>
Replace the $IdViaAnnotationObj and $AdvancedExternalizer values as required.