Just a second...

Load publishers by using the API

You can configure and load custom publishers using the Diffusion™ API at any point in the Diffusion server's lifecycle.

Similarly to loading publishers using configuration files, each publisher must have at least a name and a class. The class must implement the publisher by extending the Publisher class. For more information, see Creating a Publisher class.

PublisherConfig config = ConfigManager.getServerConfig().addPublisher("MyPublisher", "com.acme.foo.MyPublisher");
Publisher publisher = Publishers.loadPublisher(config);

The name must be unique on the server, and the class must exist on the classpath of the Diffusion server. For more information, see Classic deployment. By default the autostart property is enabled on the PublisherConfig, so the publisher starts once it is loaded. If this option is disabled, you can load a publisher and retain a reference to it, to start at a later point in time.

If the default configuration options are suitable for your requirements (as detailed within the API docs for com.pushtechnology.diffusion.api.config.PublisherConfig) there are several convenience methods that can be used to load a given publisher and get a reference to it without the need for construction a specific PublisherConfig instance.

// Create Publisher with classname
Publisher publisher = Publishers.createPublisher("MyPublisher", "com.acme.foo.MyPublisher");
		
// Create Publisher with Class
Publisher publisher = Publishers.createPublisher("MyPublisher", MyPublisher.class);

You can load a default publisher instance. This facilitates programmatic access any features exposed through the publisher abstract class that do not require method overriding.

Publisher publisher = Publishers.createPublisher("MyDefaultPublisher");