[[extending]]
= Extending {brandname}
{brandname} can be extended to provide the ability for an end user to add
additional configurations, operations and components outside of the scope of the ones normally provided by {brandname}.

{brandname} is extended by providing implementations of the link:../../apidocs/org/infinispan/lifecycle/ModuleLifecyle.html[`ModuleLifecycle`]
interface. This interface allows {brandname} to be extended and modified at various stages of its lifecycle.

== Custom Commands
{brandname} makes use of a link:http://en.wikipedia.org/wiki/Command_pattern[command/visitor pattern] to
implement the various top-level methods you see on the public-facing API.

Module authors can extend and enhance {brandname} by creating new custom commands and registering them with the `EmbeddedCacheManager`.

You do so by:

. Implementing custom commands and interceptors to provide the desired functionality
. Add ProtoStream annotations to commands to ensure they can be marshalled
. Generate `.proto` schema files and marshaller code by creating an interface annotated with `@ProtoSchema`
. Register the generated `SerializationContextInitializer` with the `GLOBAL` `SerializationContextRegistry`

See the link:https://github.com/infinispan/infinispan/tree/main/query[infinispan-query] module as an example of a custom
module that adds both custom commands and interceptors.

== Extending the configuration builders and parsers
If a custom module requires configuration, it is possible to enhance {brandname}'s configuration builders and
parsers. Look at the link:https://github.com/infinispan/infinispan/blob/main/core/src/test/java/org/infinispan/configuration/module[custom module tests]
for a detail example on how to implement this.
