Extensible Common Data Adapter: Reading and Writing over AMQP

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Extensible Common Data Adapter: Reading and Writing over AMQP

Return to chapter overview

You configure the Extensible Common Data Adapter (ECDA)  to read or write over AMQP using server options and foreign table/stream options. You reference the library com.sqlstream.plugin.common.AmqpColumnSet, as in the following code:

CREATE OR REPLACE SERVER "NetWriterServer"

FOREIGN DATA WRAPPER "NetWriterWrapper"

OPTIONS (classname 'com.sqlstream.plugin.common.AmqpColumnSet');

 

Next, you create a foreign stream object. This object contains connection information for the socket, such as format type, port, character encoding, whether or not to write a header, and the host name. Streams, like most SQL objects (but unlike data wrappers and servers), should be created within a schema. The following code first creates a schema in which to run the rest of the sample code below, then creates a foreign stream named "NetWriterStream."

CREATE OR REPLACE SCHEMA "AMQPWRITER"

SET SCHEMA 'AMQPWRITER'

CREATE OR REPLACE FOREIGN STREAM "NetWriterStream"

("STR1" VARCHAR(32))

SERVER "NetWriterServer"

OPTIONS

(format_type 'CSV',

remote_port '5651',

character_encoding 'UTF-8',

write_header 'FALSE',

remote_host 'localhost');

 

Option

Description

Req'd

Default

AMQP_HOST

Host on which the message broker resides. Extensible Common Data Adapter does not work with version 1.0.

Y f

 

AMQ_PORT

Port at which the message broker accepts connections.

Y

5672

AMQP_EXCHANGE_TYPE

Fanout, topic, or direct.

 

fanout

AMQP_EXCHANGE_NAME

Named exchange on broker.

Y