[id='implementing_proto_marshallers']
= Manually Implementing Serialization Context Initializers
In some cases you might need to manually define `.proto` schema files and
implement ProtoStream marshallers. For example, if you cannot modify Java
object classes to add annotations.

.Procedure

. Create a `.proto` schema with Protobuf messages.
+
[source,proto]
----
include::config_examples/library.proto[]
----
+
. Use the `org.infinispan.protostream.MessageMarshaller` interface to implement
marshallers for your classes.
+
[source,java]
.BookMarshaller.java
----
include::code_examples/BookMarshaller.java[]
----
+
[source,java]
.AuthorMarshaller.java
----
include::code_examples/AuthorMarshaller.java[]
----
+
. Create a `SerializationContextInitializer` implementation that registers the
`.proto` schema and the ProtoStream marshaller implementations with a
`SerializationContext`.
+
[source,java]
.ManualSerializationContextInitializer.java
----
include::code_examples/ManualSerializationContextInitializer.java[]
----
