in publish-events/channel-connection/client-libraries/java/src/main/java/com/google/cloud/eventarc/publishing/example/PublishEventsExample.java [126:140]
public static void main(String[] args) throws Exception {
String projectId = args[0];
String region = args[1];
String channelConnection = args[2];
// Controls the format of events sent to Eventarc.
// 'true' for using text format.
// 'false' for proto (preferred) format.
boolean useTextEvent = args.length > 3 ? Boolean.parseBoolean(args[3]) : false;
String channelName = "projects/" + projectId + "/locations/" + region + "/channelConnections/" + channelConnection;
System.out.println("Channel: " + channelName);
System.out.println("useTextEvent: " + useTextEvent);
new PublishEventsExample().SendPublishEvent(channelName, useTextEvent);
}