What is best practice for implementing INHERITANCE in EPL code?

When developing applications (monitors and events), it seems obvious that many monitors and some events would benefit from the ability to extend a base functionality.

What does the Apama development community consider a best-practice for implementing basic inheritance simply in EPL, and if not, in Java?

Thanks in advance!

Hello Software AG? Is anybody out there?

Is there an answer to my question?
Also, I am wondering how to get support for the Apama product?
Thank you

Please note - These forums are for Tech Community members to help each other. Software AG unfortunately cannot commit to reply to individual posts. Software AG (paid) support for Apama is available from the Empower portal here - https://empower.softwareag.com/default.asp

There is no official inheritance in EPL but there are a few work-arounds/patterns that can be used to make it feel like inheritance.

‘Has a’ event Member
A simple way is have the base implementation in an event, then have an event member variable in the specialisation. For example:-


event Base {

	action DoSomething() {
		log "Do Something";
	}
}

event Test1 {
	
	Base base;
	
	action DoSomething() {
		base.DoSomething();
	}

	action DoSomethingElse() {
		log "Do Something Else";
	}
}

You can duplicate the Base actions and call through, or just call via the base variable:-


(new Test1).base.DoSomething();

Closures/Interfaces/Factory
A more complex example uses Closures/Interfaces and some sort of Factory to assign the correct action implementation to the closure. For example:-


event TestInterface {

	action<> DoSomething;
	action<> DoSomethingElse;
}

event Base {
	
	action DoSomething() {
		log "Do Something";
	}
}

event TestImpl {
	
	Base base;
	TestInterface iface;
	
	action Create() returns TestInterface {
		
		iface.DoSomething := base.DoSomething;
		iface.DoSomethingElse := DoSomethingElse;
		
		return iface;
	}
	
	action DoSomethingElse() {
		log "Do Something Else";
	}
}

And you can even combine the 2 to have an interface on the base event as a member of the specialisation interface.