examples/pubsub-publish-avro-example/src/main/java/com/google/cloud/pso/pubsub/common/ObjectPublisher.java
/**
     * This method is used to configure {@link ObjectPublisher} using custom {@link Args} and to
     * publish records to Pub/Sub
     *
     * @param args         Parameters to configure {@link BatchingSettings} and other properties
     * @param objectReader A {@link ObjectReader} class that provides objects to publish
     * @throws IOException
     */
This method is used to configure  ObjectPublisher using custom  Args and to
publish records to Pub/Sub

@param args         Parameters to configure  BatchingSettings and other properties
@param objectReader A  ObjectReader class that provides objects to publish
@throws IOException
This method is used to configure ObjectPublisher using custom Args and to publish records to Pub / Sub @param args Parameters to configure BatchingSettings and other properties @param objectReader A ObjectReader class that provides objects to publish @throws IOException
public void run(Args args, ObjectReader<T> objectReader) throws IOException {
        init(args);
        long count = 0;
        while (objectReader.hasNext()) {
            T record = objectReader.next();
            publish(record);
            if (++count % 10000 == 0) {
                System.out.println("Published " + count + " messages.");
            }
        }
        if (count % 10000 != 0) {
            System.out.println("Published " + count + " messages.");
        }
        waitForPublishes();
    }
public void run ( Args args , ObjectReader < T > objectReader ) throws IOException { init ( args ) ; long count = 0 ; while ( objectReader . hasNext ( ) ) { T record = objectReader . next ( ) ; publish ( record ) ; if ( ++ count % 10000 == 0 ) { System . out . println ( "Published " + count + " messages." ) ; } } if ( count % 10000 != 0 ) { System . out . println ( "Published " + count + " messages." ) ; } waitForPublishes ( ) ; }
This method is used to configure {@link ObjectPublisher} using custom {@link Args} and to
 publish records to Pub/Sub
This method is used to configure { @link ObjectPublisher } using custom { @link Args } and to publish records to Pub / Sub