Class JavaScriptUDF.Builder (1.147.0)

public static final class JavaScriptUDF.Builder extends GeneratedMessage.Builder<JavaScriptUDF.Builder> implements JavaScriptUDFOrBuilder

User-defined JavaScript function that can transform or filter a Pub/Sub message.

Protobuf type google.pubsub.v1.JavaScriptUDF

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

Methods

build()

public JavaScriptUDF build()
Returns
Type Description
JavaScriptUDF

buildPartial()

public JavaScriptUDF buildPartial()
Returns
Type Description
JavaScriptUDF

clear()

public JavaScriptUDF.Builder clear()
Returns
Type Description
JavaScriptUDF.Builder
Overrides

clearCode()

public JavaScriptUDF.Builder clearCode()

Required. JavaScript code that contains a function function_name with the below signature:

` /**

  • Transforms a Pub/Sub message.

  • @return {(Object<string, (string | Object<string, string>)>|null)} - To

  • filter a message, return
null. To transform a message return a map
  • with the following keys:
    • (required) 'data' : {string}
    • (optional) 'attributes' : {Object<string, string>}
  • Returning empty
  • attributes will remove all attributes from the
  • message. *
  • @param {(Object<string, (string | Object<string, string>)>} Pub/Sub
  • message. Keys:
    • (required) 'data' : {string}
    • (required) 'attributes' : {Object<string, string>} *
  • @param {Object<string, any>} metadata - Pub/Sub message metadata.
  • Keys:
    • (optional) 'message_id' : {string}
    • (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format
    • (optional) 'ordering_key': {string} */

    function <function_name>(message, metadata) { }

  • `

    string code = 2 [(.google.api.field_behavior) = REQUIRED];

    Returns
    Type Description
    JavaScriptUDF.Builder

    This builder for chaining.

    clearFunctionName()

    public JavaScriptUDF.Builder clearFunctionName()

    Required. Name of the JavasScript function that should applied to Pub/Sub messages.

    string function_name = 1 [(.google.api.field_behavior) = REQUIRED];

    Returns
    Type Description
    JavaScriptUDF.Builder

    This builder for chaining.

    getCode()

    public String getCode()

    Required. JavaScript code that contains a function function_name with the below signature:

    ` /**

    • Transforms a Pub/Sub message.

    • @return {(Object<string, (string | Object<string, string>)>|null)} - To

    • filter a message, return
    null. To transform a message return a map
  • with the following keys:
    • (required) 'data' : {string}
    • (optional) 'attributes' : {Object<string, string>}
  • Returning empty
  • attributes will remove all attributes from the
  • message. *
  • @param {(Object<string, (string | Object<string, string>)>} Pub/Sub
  • message. Keys:
    • (required) 'data' : {string}
    • (required) 'attributes' : {Object<string, string>} *
  • @param {Object<string, any>} metadata - Pub/Sub message metadata.
  • Keys:
    • (optional) 'message_id' : {string}
    • (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format
    • (optional) 'ordering_key': {string} */

    function <function_name>(message, metadata) { }

  • `

    string code = 2 [(.google.api.field_behavior) = REQUIRED];

    Returns
    Type Description
    String

    The code.

    getCodeBytes()

    public ByteString getCodeBytes()

    Required. JavaScript code that contains a function function_name with the below signature:

    ` /**

    • Transforms a Pub/Sub message.

    • @return {(Object<string, (string | Object<string, string>)>|null)} - To

    • filter a message, return
    null. To transform a message return a map
  • with the following keys:
    • (required) 'data' : {string}
    • (optional) 'attributes' : {Object<string, string>}
  • Returning empty
  • attributes will remove all attributes from the
  • message. *
  • @param {(Object<string, (string | Object<string, string>)>} Pub/Sub
  • message. Keys:
    • (required) 'data' : {string}
    • (required) 'attributes' : {Object<string, string>} *
  • @param {Object<string, any>} metadata - Pub/Sub message metadata.
  • Keys:
    • (optional) 'message_id' : {string}
    • (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format
    • (optional) 'ordering_key': {string} */

    function <function_name>(message, metadata) { }

  • `

    string code = 2 [(.google.api.field_behavior) = REQUIRED];

    Returns
    Type Description
    ByteString

    The bytes for code.

    getDefaultInstanceForType()

    public JavaScriptUDF getDefaultInstanceForType()
    Returns
    Type Description
    JavaScriptUDF

    getDescriptorForType()

    public Descriptors.Descriptor getDescriptorForType()
    Returns
    Type Description
    Descriptor
    Overrides

    getFunctionName()

    public String getFunctionName()

    Required. Name of the JavasScript function that should applied to Pub/Sub messages.

    string function_name = 1 [(.google.api.field_behavior) = REQUIRED];

    Returns
    Type Description
    String

    The functionName.

    getFunctionNameBytes()

    public ByteString getFunctionNameBytes()

    Required. Name of the JavasScript function that should applied to Pub/Sub messages.

    string function_name = 1 [(.google.api.field_behavior) = REQUIRED];

    Returns
    Type Description
    ByteString

    The bytes for functionName.

    internalGetFieldAccessorTable()

    protected GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
    Returns
    Type Description
    FieldAccessorTable
    Overrides

    isInitialized()

    public final boolean isInitialized()
    Returns
    Type Description
    boolean
    Overrides

    mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

    public JavaScriptUDF.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
    Parameters
    Name Description
    input CodedInputStream
    extensionRegistry ExtensionRegistryLite
    Returns
    Type Description
    JavaScriptUDF.Builder
    Overrides
    Exceptions
    Type Description
    IOException

    mergeFrom(Message other)

    public JavaScriptUDF.Builder mergeFrom(Message other)
    Parameter
    Name Description
    other Message
    Returns
    Type Description
    JavaScriptUDF.Builder
    Overrides

    mergeFrom(JavaScriptUDF other)

    public JavaScriptUDF.Builder mergeFrom(JavaScriptUDF other)
    Parameter
    Name Description
    other JavaScriptUDF
    Returns
    Type Description
    JavaScriptUDF.Builder

    setCode(String value)

    public JavaScriptUDF.Builder setCode(String value)

    Required. JavaScript code that contains a function function_name with the below signature:

    ` /**

    • Transforms a Pub/Sub message.

    • @return {(Object<string, (string | Object<string, string>)>|null)} - To

    • filter a message, return
    null. To transform a message return a map
  • with the following keys:
    • (required) 'data' : {string}
    • (optional) 'attributes' : {Object<string, string>}
  • Returning empty
  • attributes will remove all attributes from the
  • message. *
  • @param {(Object<string, (string | Object<string, string>)>} Pub/Sub
  • message. Keys:
    • (required) 'data' : {string}
    • (required) 'attributes' : {Object<string, string>} *
  • @param {Object<string, any>} metadata - Pub/Sub message metadata.
  • Keys:
    • (optional) 'message_id' : {string}
    • (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format
    • (optional) 'ordering_key': {string} */

    function <function_name>(message, metadata) { }

  • `

    string code = 2 [(.google.api.field_behavior) = REQUIRED];

    Parameter
    Name Description
    value String

    The code to set.

    Returns
    Type Description
    JavaScriptUDF.Builder

    This builder for chaining.

    setCodeBytes(ByteString value)

    public JavaScriptUDF.Builder setCodeBytes(ByteString value)

    Required. JavaScript code that contains a function function_name with the below signature:

    ` /**

    • Transforms a Pub/Sub message.

    • @return {(Object<string, (string | Object<string, string>)>|null)} - To

    • filter a message, return
    null. To transform a message return a map
  • with the following keys:
    • (required) 'data' : {string}
    • (optional) 'attributes' : {Object<string, string>}
  • Returning empty
  • attributes will remove all attributes from the
  • message. *
  • @param {(Object<string, (string | Object<string, string>)>} Pub/Sub
  • message. Keys:
    • (required) 'data' : {string}
    • (required) 'attributes' : {Object<string, string>} *
  • @param {Object<string, any>} metadata - Pub/Sub message metadata.
  • Keys:
    • (optional) 'message_id' : {string}
    • (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format
    • (optional) 'ordering_key': {string} */

    function <function_name>(message, metadata) { }

  • `

    string code = 2 [(.google.api.field_behavior) = REQUIRED];

    Parameter
    Name Description
    value ByteString

    The bytes for code to set.

    Returns
    Type Description
    JavaScriptUDF.Builder

    This builder for chaining.

    setFunctionName(String value)

    public JavaScriptUDF.Builder setFunctionName(String value)

    Required. Name of the JavasScript function that should applied to Pub/Sub messages.

    string function_name = 1 [(.google.api.field_behavior) = REQUIRED];

    Parameter
    Name Description
    value String

    The functionName to set.

    Returns
    Type Description
    JavaScriptUDF.Builder

    This builder for chaining.

    setFunctionNameBytes(ByteString value)

    public JavaScriptUDF.Builder setFunctionNameBytes(ByteString value)

    Required. Name of the JavasScript function that should applied to Pub/Sub messages.

    string function_name = 1 [(.google.api.field_behavior) = REQUIRED];

    Parameter
    Name Description
    value ByteString

    The bytes for functionName to set.

    Returns
    Type Description
    JavaScriptUDF.Builder

    This builder for chaining.