ChannelReceiverFunction

ChannelReceiverFunction[fun]

represents a channel receiver function that applies fun to any channel message it receives.

Details and Options

  • CloudDeploy[ChannelReceiverFunction[]] yields a CloudObject containing meta-information that specifies the channel to which messages for the channel receiver should be sent.
  • CloudDeploy[ChannelReceiverFunction[]"curi"] deploys the receiver to ChannelObject["curi"].
  • CloudDeploy[ChannelReceiverFunction[]channel] deploys the receiver to the specified channel, given as ChannelObject[].
  • CloudDeploy[ChannelReceiverFunction[]] is equivalent to CloudDeploy[ChannelReceiverFunction[]Automatic].
  • In a deployed ChannelReceiverFunction[fun], fun[assoc] is evaluated whenever a channel message is received. The association assoc contains the same elements as in ChannelListen, except for ones specific to the ChannelListener object.
  • CloudDeploy[ChannelReceiverFunction[fun]] sets up a channel receiver function that is executed in the cloud and does not require active listeners in any specific Wolfram Language session.
  • The function fun is evaluated in the environment of the owner of the channel receiver function.

Examples

open allclose all

Basic Examples  (2)

Define a receiver function:

In[1]:=
Click for copyable input
Out[1]=

Apply the function to an association representing a channel broker message:

In[2]:=
Click for copyable input
Out[2]=

Define a receiver function that logs the incoming message to a cloud object:

In[1]:=
Click for copyable input
Out[1]=

Deploy the function:

In[2]:=
Click for copyable input
Out[2]=

Obtain the target channel of the receiver:

In[3]:=
Click for copyable input
Out[3]=

Send a message to the channel:

In[4]:=
Click for copyable input
Out[4]=

Check the cloud object:

In[5]:=
Click for copyable input
Out[5]=

Scope  (7)

Applications  (3)

Properties & Relations  (1)

See Also

ChannelListen  MailReceiverFunction  APIFunction  ChannelDatabin  ChannelBrokerAction

Introduced in 2017
(11.2)