Class HttpTriggerListener
- java.lang.Object
-
- org.apache.solr.cloud.autoscaling.TriggerListenerBase
-
- org.apache.solr.cloud.autoscaling.HttpTriggerListener
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,TriggerListener
public class HttpTriggerListener extends TriggerListenerBase
Simple HTTP callback that POSTs event data to a URL. URL, payload and headers may contain property substitution patterns, with the following properties available:- config.* - listener configuration
- event.* - event properties
- stage - current stage of event processing
- actionName - optional current action name
- context.* - optional
ActionContext
properties - error - optional error string (from
Throwable.toString()
) - message - optional message
- url - a URL template
- payload - string, optional payload template. If absent a JSON map of all properties listed above will be used.
- contentType - string, optional payload content type. If absent then
application/json
will be used. - header.* - string, optional header template(s). The name of the property without "header." prefix defines the literal header name.
- timeout - int, optional connection and socket timeout in milliseconds. Default is 60 seconds.
- followRedirects - boolean, optional setting to follow redirects. Default is false.
-
-
Field Summary
-
Fields inherited from class org.apache.solr.cloud.autoscaling.TriggerListenerBase
cloudManager, config, enabled, loader, requiredProperties, validProperties, validPropertyPrefixes
-
-
Constructor Summary
Constructors Constructor Description HttpTriggerListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configure(SolrResourceLoader loader, SolrCloudManager cloudManager, AutoScalingConfig.TriggerListenerConfig config)
Called when listener is created but before it's initialized and used.void
onEvent(TriggerEvent event, TriggerEventProcessorStage stage, String actionName, ActionContext context, Throwable error, String message)
This method is called when either a particularstage
oractionName
is reached during event processing.-
Methods inherited from class org.apache.solr.cloud.autoscaling.TriggerListenerBase
close, getConfig, init, isEnabled
-
-
-
-
Method Detail
-
configure
public void configure(SolrResourceLoader loader, SolrCloudManager cloudManager, AutoScalingConfig.TriggerListenerConfig config) throws TriggerValidationException
Description copied from interface:TriggerListener
Called when listener is created but before it's initialized and used. This method should also verify that the configuration parameters are correct. It may be called multiple times.- Specified by:
configure
in interfaceTriggerListener
- Overrides:
configure
in classTriggerListenerBase
- Parameters:
loader
- loader to use for instantiating sub-componentscloudManager
- current instance of SolrCloudManagerconfig
- coniguration- Throws:
TriggerValidationException
- contains details of invalid configuration parameters.
-
onEvent
public void onEvent(TriggerEvent event, TriggerEventProcessorStage stage, String actionName, ActionContext context, Throwable error, String message)
Description copied from interface:TriggerListener
This method is called when either a particularstage
oractionName
is reached during event processing.- Parameters:
event
- current event being processedstage
-TriggerEventProcessorStage
that this listener was registered for, or nullactionName
-TriggerAction
name that this listener was registered for, or nullcontext
- optionalActionContext
when the processing stage is related to an action, or nullerror
- optionalThrowable
error, or nullmessage
- optional message
-
-