Publishing in direct access mode is a multistep process that involves creating and connecting to a publisher, then identifying the stream to publish to and the data to publish.
The following code snippets are provided to illustrate one way of publishing and
not as a complete, working example. Adapt this sample as necessary to suit your specific
publishing scenario.
- Create a publisher:
NetEspCredentials creds = new NetEspCredentials
(NetEspCredentials.NET_ESP_CREDENTIALS_T.NET_ESP_CREDENTIALS_USER_PASSWORD);
creds.set_user("user");
creds.set_password("password");
NetEspPublisher publisher = project.create_publisher(creds, error);
- Connect to the publisher:
Publisher.connect(error);
- Get a stream:
NetEspStream stream = project.get_stream("WIN2", error);
- Get the Message Writer:
NetEspMessageWriter writer = publisher.get_message_writer(stream,
error);
- Get and start the Row Writer, and set an opcode to insert one row:
NetEspRelativeRowWriter rowwriter = writer.get_relative_row_writer(error);
rowwriter.start_row(error);
rowwriter.set_opcode(1, error);
- Set the column values sequentially, starting from the first column. Call the appropriate set method for the data type of the column. For example, if the column type is string:
rc = rowwriter.set_string(“some value”, error);
- When you have set all column values, end the row:
rc = rowwriter.end_row(error);
- Publish the data:
rc = publisher.publish(writer, error);