Procyon
It is a main module providing all features of Procyon. This part gives you a basic understanding of Procyon Module. That's why It covers only ApplicationRunListener and ApplicationRunner which it provides.
New Application
To run an application with Procyon, create an instance of Procyon Application by using the function procyon.NewProcyonApplication.
After that, it's easy to run, just call the method Run.
import (
"github.com/procyon-projects/procyon"
)
func main() {
myApp := procyon.NewProcyonApplication()
myApp.Run()
}
Application Run Listener
It's used to do something while application starts.
Note that you need to register pea processors and initializers by using the function core.Register.
type ApplicationRunListener interface {
OnApplicationStarting()
OnApplicationEnvironmentPrepared(environment core.ConfigurableEnvironment)
OnApplicationContextPrepared(context context.ConfigurableApplicationContext)
OnApplicationContextLoaded(context context.ConfigurableApplicationContext)
OnApplicationStarted(context context.ConfigurableApplicationContext)
OnApplicationRunning(context context.ConfigurableApplicationContext)
OnApplicationFailed(context context.ConfigurableApplicationContext, err error)
}
- OnApplicationStarting is invoked when the application starts
- OnApplicationEnvironmentPrepared is invoked when the environment of the application is prepared.
- OnApplicationContextPrepared is invoked when the context of the application is prepared.
- OnApplicationContextLoaded is invoked when the context of the application is loaded.
- OnApplicationStarted is invoked when the application is started.
- OnApplicationRunning is invoked when the application is run successfully.
- OnApplicationFailed is invoked if any error occurs while the application starts.
Application Runner
It's used to do something after application runs.
Note that you need to register pea processors and initializers by using the function core.Register.
type ApplicationRunner interface {
OnApplicationRun(context context.Context, arguments ApplicationArguments)
}