private GatEvent BuildThriftEvent(IGatEvent evt) { GatEvent ret = new GatEvent(); //required ret.Id = evt.Id; ret.Type = (Gat.Event.Thrift.GatEventType)(int) evt.Type; //optional if (evt.Catalog != null) { ret.Catalog = evt.Catalog; } if (evt.RowSet != null) { ret.RowSet = BuildThriftRowSet(evt.RowSet); } if (evt.Schema != null) { ret.Schema = evt.Schema; } if (evt.Sql != null) { ret.Sql = evt.Sql; } if (evt.Table != null) { ret.Table = evt.Table; } return(ret); }
private GatEvent BuildThriftEvent(IGatEvent evt) { GatEvent ret = new GatEvent(); //required ret.Id = evt.Id; ret.Type = (Gat.Event.Thrift.GatEventType)(int)evt.Type; //optional if (evt.Catalog != null) { ret.Catalog = evt.Catalog; } if (evt.RowSet != null) { ret.RowSet = BuildThriftRowSet(evt.RowSet); } if (evt.Schema != null) { ret.Schema = evt.Schema; } if (evt.Sql != null) { ret.Sql = evt.Sql; } if (evt.Table != null) { ret.Table = evt.Table; } return ret; }
public RunnerDelegate PrepareAction(IGatEvent evt, bool forceClone) { //we clone anyways, regardless of whether forced since we go over the wire GatEvent clonedEvt = BuildThriftEvent(evt); TTransport transport = new TSocket(_host, _port); GatConsumer.Client client = new GatConsumer.Client(new TBinaryProtocol(transport)); transport.Open(); return new RunnerDelegate(delegate() { try { return new ThriftEventResponse(client.onEvent(clonedEvt)); } finally { try { transport.Close(); } catch (Exception) { } } }); }
public RunnerDelegate PrepareAction(IGatEvent evt, bool forceClone) { //we clone anyways, regardless of whether forced since we go over the wire GatEvent clonedEvt = BuildThriftEvent(evt); TTransport transport = new TSocket(_host, _port); GatConsumer.Client client = new GatConsumer.Client(new TBinaryProtocol(transport)); transport.Open(); return(new RunnerDelegate(delegate() { try { return new ThriftEventResponse(client.onEvent(clonedEvt)); } finally { try { transport.Close(); } catch (Exception) { } } })); }
public static void RunAsync(IAction action, IGatEvent evt) { action.PrepareAction(evt, true).BeginInvoke(null, null); }
public static IGatEventResponse RunSync(IAction action, IGatEvent evt) { return(action.PrepareAction(evt, false).Invoke()); }
public static IGatEventResponse RunSync(IAction action, IGatEvent evt) { return action.PrepareAction(evt, false).Invoke(); }
public static void RunAsync(IAction action, IGatEvent evt) { action.PrepareAction(evt, true).BeginInvoke(null, null); }