/// <summary> /// Constructor. /// </summary> public ControlClientUpdatingPagedTopics() { session = Diffusion.Sessions.Principal( "control" ).Password( "password" ) .Open( "ws://diffusion.example.com:80" ); topicControl = session.GetTopicControlFeature(); var updateControl = session.GetTopicUpdateControlFeature(); orderedUpdateFactory = updateControl.UpdateFactory<IPagedRecordOrderedUpdateFactory>(); unorderedUpdateFactory = updateControl.UpdateFactory<IPagedStringUnorderedUpdateFactory>(); var metadata = Diffusion.Metadata; // Create an unordered paged string topic topicControl.AddTopic( UnorderedTopic, topicControl.NewDetails( TopicType.PAGED_STRING ), new TopicControlAddCallbackDefault() ); // Create an ordered paged record topic var recordMetadata = metadata.Record( "Record", metadata.String( "Name" ), metadata.String( "Address" ) ); topicControl.AddTopic( OrderedTopic, topicControl.CreateDetailsBuilder<IPagedRecordTopicDetailsBuilder>() .Metadata( recordMetadata ) .Order( new PagedRecordOrderKey( "Name" ) ) .Build(), new TopicControlAddCallbackDefault() ); // Register an updater for topics under the 'Paged' branch updateControl.RegisterUpdateSource( "Paged", new UpdateSource() ); }
/// <summary> /// Constructor. /// </summary> public ControlClientUpdatingPagedTopics() { session = Diffusion.Sessions.Principal("control").Password("password") .Open("ws://diffusion.example.com:80"); topicControl = session.GetTopicControlFeature(); var updateControl = session.GetTopicUpdateControlFeature(); orderedUpdateFactory = updateControl.UpdateFactory <IPagedRecordOrderedUpdateFactory>(); unorderedUpdateFactory = updateControl.UpdateFactory <IPagedStringUnorderedUpdateFactory>(); var metadata = Diffusion.Metadata; // Create an unordered paged string topic topicControl.AddTopic(UnorderedTopic, topicControl.NewDetails(TopicType.PAGED_STRING), new TopicControlAddCallbackDefault()); // Create an ordered paged record topic var recordMetadata = metadata.Record("Record", metadata.String("Name"), metadata.String("Address")); topicControl.AddTopic(OrderedTopic, topicControl.CreateDetailsBuilder <IPagedRecordTopicDetailsBuilder>() .Metadata(recordMetadata) .Order(new PagedRecordOrderKey("Name")) .Build(), new TopicControlAddCallbackDefault()); // Register an updater for topics under the 'Paged' branch updateControl.RegisterUpdateSource("Paged", new UpdateSource()); }