12.5. Invoking the Compound Procedure

Documentation

VoltDB Home » Documentation » Guide to Performance and Customization

12.5. Invoking the Compound Procedure

The primary use case for compound procedures is processing incoming topics. Therefore, the common way to initiate the procedure is to name it as part of the topic definition in the configuration file. You do this using the procedure attribute of the <topic> element. For example, to associate the example compound procedure defined in this chapter with the BasicMessage topic, the configuration looks like this:

<topics>
   <topic name="BasicMessage" procedure="ProcessMessage"/>
</topics>

Similarly, you can use compound procedures as the target for import connectors. For example, the following configuration associates the compound procedure to a topic from an external Kafka server:

<import>
  <configuration type="kafka" enabled="true">
     <property name="brokers">mykafkasvr:9092</property>
     <property name="topics">BasicMessage</property>
     <property name="procedure">ProcessMessage</property>
  </configuration>
</import>

When declared as the target of an inbound topic or import connector, the compound procedure is invoked once for every record received. You can also generate individual invocations of the procedure in the same way you do any other stored procedure: programmatically (such as with the Java callProcedure method) or manually through the sqlcmd EXEC directive:

$ sqlcmd
1> exec ProcessMessage 123 "This is a test";