共用方式為


KafkaOutput Interface

public interface KafkaOutput

KafkaOutput(name = "event", topic = "users", brokerList="broker:29092") OutputBinding<String<output, final ExecutionContext context) { context.getLogger().info("Message:" + message); output.setValue(message); return "{ \"id": "" + System.currentTimeMillis() + "", "description": "" + message + "" }"; }

Method Summary

Modifier and Type Method and Description
BrokerAuthenticationMode authenticationMode()

SASL mechanism to use for authentication. Default: PLAIN

int batchSize()

Defines the maximum number of messages batched in one MessageSet. default: 10000

String brokerList()

Defines the BrokerList.

String dataType()

Defines how Functions runtime should treat the parameter value. Possible values are:

    <li>
    
      <p>"" or string: treat it as a string whose value is serialized from the parameter </p>
    
    </li>
    
    <li>
    
      <p>binary: treat it as a binary data whose value comes from for example OutputBinding&lt;byte[]&lt;</p>
    
    </li>
    

boolean enableIdempotence()

When set to `true`, the producer will ensure that messages are successfully produced exactly once and in the original produce order. default: false

int maxMessageBytes()

Defines the maximum transmit message size. Default: 1MB

int maxRetries()

How many times to retry sending a failing Message. **Note:** default: 2 Retrying may cause reordering unless EnableIdempotence is set to true.

int messageTimeoutMs()

Local message timeout. This value is only enforced locally and limits the time a produced message waits for successful delivery. A time of 0 is infinite. This is the maximum time used to deliver a message (including retries). Delivery error occurs when either the retry count or the message timeout are exceeded. default: 300000

String name()

The variable name used in function.json.

String password()

SASL password with the PLAIN and SASL-SCRAM-.. mechanisms Default is plaintext

security.protocol in librdkafka

BrokerProtocol protocol()

Gets or sets the security protocol used to communicate with brokers default is PLAINTEXT

int requestTimeoutMs()

The ack timeout of the producer request in milliseconds. default: 5000

String sslCaLocation()

Path to CA certificate file for verifying the broker's certificate. ssl.ca.location in librdkafka

String sslCertificateLocation()

Path to client's certificate. ssl.certificate.location in librdkafka

String sslKeyLocation()

Path to client's private key (PEM) used for authentication. Default "" ssl.key.location in librdkafka

String sslKeyPassword()

Password for client's certificate. ssl.key.password in librdkafka

String topic()

Defines the Topic.

String username()

SASL username with the PLAIN and SASL-SCRAM-.. mechanisms Default: ""

Method Details

authenticationMode

public BrokerAuthenticationMode authenticationMode() default BrokerAuthenticationMode.NOTSET

SASL mechanism to use for authentication. Default: PLAIN

Returns:

The SASL mechanism.

batchSize

public int batchSize() default 10000

Defines the maximum number of messages batched in one MessageSet. default: 10000

Returns:

The maximum number of messages batched in one MessageSet.

brokerList

public String brokerList()

Defines the BrokerList.

Returns:

The brokerList name string.

dataType

public String dataType() default ""

Defines how Functions runtime should treat the parameter value. Possible values are:

    <li>
    
      <p>"" or string: treat it as a string whose value is serialized from the parameter </p>
    
    </li>
    
    <li>
    
      <p>binary: treat it as a binary data whose value comes from for example OutputBinding&lt;byte[]&lt;</p>
    
    </li>
    

Returns:

The dataType which will be used by the Functions runtime.

enableIdempotence

public boolean enableIdempotence() default false

When set to `true`, the producer will ensure that messages are successfully produced exactly once and in the original produce order. default: false

Returns:

whether idempotence is enabled.

maxMessageBytes

public int maxMessageBytes() default 1000012

Defines the maximum transmit message size. Default: 1MB

Returns:

The maximum trnasmit message size.

maxRetries

public int maxRetries() default 2

How many times to retry sending a failing Message. **Note:** default: 2 Retrying may cause reordering unless EnableIdempotence is set to true.

Returns:

The number of the max retries.

messageTimeoutMs

public int messageTimeoutMs() default 300000

Local message timeout. This value is only enforced locally and limits the time a produced message waits for successful delivery. A time of 0 is infinite. This is the maximum time used to deliver a message (including retries). Delivery error occurs when either the retry count or the message timeout are exceeded. default: 300000

Returns:

The local message timeout.

name

public String name()

The variable name used in function.json.

Returns:

The variable name used in function.json.

password

public String password() default ""

SASL password with the PLAIN and SASL-SCRAM-.. mechanisms Default is plaintext

security.protocol in librdkafka

Returns:

The SASL password.

protocol

public BrokerProtocol protocol() default BrokerProtocol.NOTSET

Gets or sets the security protocol used to communicate with brokers default is PLAINTEXT

Returns:

The protocol.

requestTimeoutMs

public int requestTimeoutMs() default 5000

The ack timeout of the producer request in milliseconds. default: 5000

Returns:

The ack timeout of the producer request in milliseconds.

sslCaLocation

public String sslCaLocation() default ""

Path to CA certificate file for verifying the broker's certificate. ssl.ca.location in librdkafka

Returns:

The ssl ca location.

sslCertificateLocation

public String sslCertificateLocation() default ""

Path to client's certificate. ssl.certificate.location in librdkafka

Returns:

The ssl certificate location.

sslKeyLocation

public String sslKeyLocation() default ""

Path to client's private key (PEM) used for authentication. Default "" ssl.key.location in librdkafka

Returns:

The ssl key location.

sslKeyPassword

public String sslKeyPassword() default ""

Password for client's certificate. ssl.key.password in librdkafka

Returns:

The ssl key password.

topic

public String topic()

Defines the Topic.

Returns:

The topic name.

username

public String username() default ""

SASL username with the PLAIN and SASL-SCRAM-.. mechanisms Default: ""

Returns:

The SASL username.

Applies to