Custom extensions can be written in Siddhi in order to cater usecase specific logics that are not out of the box available in Siddhi.
Refer SiddhiQL Guide 3.1#WritingCustomExtensions to get a general idea of how to write an extension.
The following sections explains how we can create different types of Siddhi Extensions in details.