Publishing in Direct Access Mode

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 illustrate one way of publishing data. Adapt this sample as necessary to suit your specific publishing scenario.

  1. Create a publisher:
    NetEspPublisher publisher = project.create_publisher(null,
    error);
  2. Connect to the publisher:
    Publisher.connect(error);
  3. Get a stream:
    NetEspStream stream = project.get_stream("WIN2", error);
  4. Get the Message Writer:
    NetEspMessageWriter writer = publisher.get_message_writer(stream,
    error);
  5. 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);
  6. 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);
  7. When you have set all column values, end the row:
    rc = rowwriter.end_row(error);
  8. Publish the data:
    rc = publisher.publish(writer, error);