static void Generate1(synapse_client <data_processors.waypoints> client, string source, uint yy, uint mm, uint dd) { var contests = new ContestsType(); var contest = new ContestType(); contest.set_competition("Australian Racing"); contest.set_contestNumber(1); contest.set_contestName(new TextType()).set_Value("Drink XXXX Responsibly Sprint"); contest.set_sportCode(SportEnum.SportEnum_gp); contest.set_datasource(source); contest.set_startDate(new DateType()).set_Value(utils.EncodeDate(yy, mm, dd)); //// var participant = new ParticipantType(); participant.set_number("1"); participant.set_barrier(new IntegerType()).set_Value(3); var entities = new EntitiesType(); var horse = entities.set_horse_element("horse", new HorseType()); horse.set_name("Small Runner"); horse.set_countryBorn(new TextType()).set_Value("AUS"); var jockey = entities.set_jockey_element("jockey", new PersonType()); jockey.set_name("S Clipperton"); jockey.set_sid("S Clipperton"); participant.set_entities(entities); contest.set_participants_element("1", participant); //// participant = new ParticipantType(); participant.set_number("1A"); participant.set_barrier(new IntegerType()).set_Value(2); entities = new EntitiesType(); entities.set_horse_element("horse", new HorseType()).set_name("Medium Runner"); participant.set_entities(entities); contest.set_participants_element("1A", participant); //// participant = new ParticipantType(); participant.set_number("2"); participant.set_barrier(new IntegerType()).set_Value(1); entities = new EntitiesType(); entities.set_horse_element("horse", new HorseType()).set_name("Large Runner"); participant.set_entities(entities); contest.set_participants_element("2", participant); // contests.set_contest_element(source + "|" + yy.ToString() + mm.ToString() + dd.ToString() + ";1000001", contest); var waypoints = new waypoints(); var waypoint = new waypoint(); waypoint.set_timestamp(data_processors.federated_serialisation.utils.EncodeDateTime(DateTime.UtcNow)); waypoint.set_tag("contests_1.example.csharp.1"); waypoints.add_path_element(waypoint); client.publish("test." + source, contests, waypoints, false); }
public static void Main(string[] args) { try { { var waypoint = new waypoint(); waypoint.set_tag("test.transform.example.1.c#"); waypoints wp = new waypoints(); var synapse_subscriber = new data_processors.synapse_client <data_processors.waypoints>("10.16.10.127"); var synapse_publisher = new data_processors.synapse_client <data_processors.waypoints>("10.16.10.127"); ReaderWriterLockSlim rwl = new ReaderWriterLockSlim(); synapse_subscriber.subscribe(rwl, new type_factory(), //"test.betfair.contests.au", "test.sim.*.*", data_processors.synapse_client_utils.timestamp(new DateTime(2015, 1, 1)), 0, // until data_processors.synapse_client_utils.timespan(new TimeSpan(20, 0, 0)), // delayed delivery tolerance true); uint i = 0; for (var msg_wrapper = synapse_subscriber.next(7000); msg_wrapper != null; msg_wrapper = synapse_subscriber.next(5000)) { if (msg_wrapper.type_name == "ContestsType" && msg_wrapper.non_delta_seen == true) { var now = DateTime.UtcNow; waypoint.set_timestamp(data_processors.federated_serialisation.utils.EncodeDateTime(now)); wp.set_from((waypoints)msg_wrapper.waypoints); wp.add_path_element(waypoint); var written_bytes = synapse_publisher.publish(msg_wrapper.amqp.routing_key + ".transformation_test_c_sharp", (ContestsType)((thrift_contests_type)msg_wrapper.msg).output_msg, wp, (i++ % 100 == 0 ? false : true), null, 0, synapse_client_utils.timestamp(now)); Console.WriteLine("republished message of " + written_bytes + " bytes"); } } synapse_subscriber.close(); synapse_publisher.close(); Console.WriteLine("bye bye"); } } catch (Exception e) { Console.WriteLine("oops " + e.Message); } }