Class JavascriptSender
- All Implemented Interfaces:
ICacheEnabled<String,,String> FrankElement,HasApplicationContext,HasName,IConfigurable,IScopeProvider,ISender,ISenderWithParameters,IWithParameters,NameAware,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware,org.springframework.context.Lifecycle
This sender can execute a function of a given Javascript file, the result of the function will be the output of the sender.
The parameters of the Javascript function to run are given as parameters by the adapter configuration
The sender doesn't accept nor uses the given input, instead for each argument for the jsFunctionName method,
you will need to create a parameter on the sender.
The result of the Javascript function should be of type String, or directly convertible to String from a primitive type or an array of primitive types / strings, as the output of the sender will be of type String.
Failure to ensure the output is a string may mean the result will look like [Object object].
- Since:
- 7.4
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class org.frankframework.senders.AbstractSenderWrapper
configurationMetrics, senderWrapperProcessorFields inherited from class org.frankframework.senders.AbstractSenderWithParameters
parameterNamesMustBeUnique, paramListFields inherited from class org.frankframework.senders.AbstractSender
log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidone or more specifications of senders that will be executed one after another.voidConfigure this component.protected booleansendMessage(Message message, PipeLineSession session) Send a message to some destination (as configured in the Sender object).voidsetEngineName(JavascriptSender.JavaScriptEngines engineName) the name of the JavaScript engine to use.voidsetJsFileName(String jsFileName) the name of the javascript file containing the functions to runvoidsetJsFunctionName(String jsFunctionName) the name of the javascript function that will be called (first)Methods inherited from class org.frankframework.senders.SenderSeries
consumesSessionVariable, doSendMessage, getSenders, getStatisticsKeeper, setSender, start, stopMethods inherited from class org.frankframework.senders.AbstractSenderWrapper
setGetInputFromFixedValue, setGetInputFromSessionKey, setName, setPreserveInput, setStoreInputInSessionKey, setStoreResultInSessionKeyMethods inherited from class org.frankframework.senders.AbstractSenderWithParameters
addParameter, checkStringAttributeOrParameter, getParameterList, getParameterOverriddenAttributeValue, getParameterOverriddenAttributeValue, getParameterValueListMethods inherited from class org.frankframework.senders.AbstractSender
createBean, getLogPrefix, getName, isRunning, setApplicationContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationContextAware
setApplicationContextMethods inherited from interface org.frankframework.core.FrankElement
addConfigWarningMethods inherited from interface org.frankframework.core.HasApplicationContext
getApplicationContext, getConfigurationClassLoaderMethods inherited from interface org.frankframework.cache.ICacheEnabled
getCache, setCacheMethods inherited from interface org.frankframework.core.ISender
isSynchronous, sendMessageOrThrow
-
Constructor Details
-
JavascriptSender
public JavascriptSender()
-
-
Method Details
-
configure
Description copied from interface:IConfigurableConfigure this component.configure()is called once at startup of the framework in the configure method of the owner of thisIConfigurable. Purpose of this method is to check whether the static configuration of the object is correct. As much as possible class-instantiating should take place in theconfigure(), to improve performance.In the case of a container, this will propagate the configure signal to all components that apply.
- Specified by:
configurein interfaceIConfigurable- Overrides:
configurein classSenderSeries- Throws:
ConfigurationException- in case it was not able to configure the component.
-
isSenderConfigured
protected boolean isSenderConfigured()- Overrides:
isSenderConfiguredin classSenderSeries
-
sendMessage
@Nonnull public SenderResult sendMessage(@Nonnull Message message, @Nonnull PipeLineSession session) throws SenderException Description copied from interface:ISenderSend a message to some destination (as configured in the Sender object). This method may only be called after theconfigure()method is called.The following table shows the difference between synchronous and a-synchronous senders:
synchronous a-synchronous ISender.isSynchronous()returnstruefalsereturn value of sendMessage()isthe reply-message the messageId of the message sent the correlationID specified with sendMessage()may be ignored is sent with the message a {link TimeOutException} may be thrown if a timeout occurs waiting for a reply should not be expected Multiple objects may try to call this method at the same time, from different threads. Implementations of this method should therefore be thread-safe, or
synchronized.- Specified by:
sendMessagein interfaceISender- Overrides:
sendMessagein classAbstractSenderWrapper- Throws:
SenderException
-
addSender
Description copied from class:SenderSeriesone or more specifications of senders that will be executed one after another. Each sender will get the result of the preceding one as input.- Overrides:
addSenderin classSenderSeries
-
setJsFileName
the name of the javascript file containing the functions to run -
setJsFunctionName
the name of the javascript function that will be called (first)- Default value
- main
-
setEngineName
the name of the JavaScript engine to use.- Default value
- J2V8
-