use of org.ballerinalang.nativeimpl.io.events.records.HasNextDelimitedRecordEvent in project ballerina by ballerina-lang.
the class HasNextTextRecord method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(Context context, CallableUnitCallback callback) {
BStruct channel = (BStruct) context.getRefArgument(TXT_RECORD_CHANNEL_INDEX);
if (channel.getNativeData(IOConstants.TXT_RECORD_CHANNEL_NAME) != null) {
DelimitedRecordChannel textRecordChannel = (DelimitedRecordChannel) channel.getNativeData(IOConstants.TXT_RECORD_CHANNEL_NAME);
EventContext eventContext = new EventContext(context, callback);
HasNextDelimitedRecordEvent hasNextEvent = new HasNextDelimitedRecordEvent(textRecordChannel, eventContext);
CompletableFuture<EventResult> event = EventManager.getInstance().publish(hasNextEvent);
event.thenApply(HasNextTextRecord::response);
}
}
Aggregations