Ejemplo n.º 1
0
#pragma warning disable RCS1168
        public DataFlowOpInitializeResult Initialize(DataFlowOpInitializateContext context)
#pragma warning restore RCS1168
        {
            if (!context.OutputPorts.IsEmpty())
            {
                throw new ArgumentException("EventBusSink operator does not provide an output stream");
            }

            var eventTypes = new EventType[context.InputPorts.Count];

            for (int i = 0; i < eventTypes.Length; i++)
            {
                eventTypes[i] = context.InputPorts.Get(i).TypeDesc.EventType;
            }
            _runtimeEventSender  = context.RuntimeEventSender;
            _eventAdapterService = context.StatementContext.EventAdapterService;

            if (collector != null)
            {
                _eventBusCollector = new EventBusCollectorImpl(
                    _eventAdapterService,
                    _runtimeEventSender);
            }
            else
            {
                _adapterFactories = new EventBeanAdapterFactory[eventTypes.Length];
                for (int i = 0; i < eventTypes.Length; i++)
                {
                    _adapterFactories[i] = context.ServicesContext.EventAdapterService.GetAdapterFactoryForType(eventTypes[i]);
                }
            }
            return(null);
        }
Ejemplo n.º 2
0
 /// <summary>Ctor. </summary>
 /// <param name="eventBusCollector">for sending events to the event bus</param>
 /// <param name="theEvent">to process</param>
 public EPDataFlowEventCollectorContext(EventBusCollector eventBusCollector, Object theEvent)
 {
     EventBusCollector = eventBusCollector;
     Event             = theEvent;
 }