1 // ******************************************************************
3 // ******************************************************************
5 #include "ace/OS_NS_unistd.h"
6 #include "Notify_Structured_Push_Consumer.h"
7 #include "Notify_Test_Client.h"
8 #include "orbsvcs/Notify/Notify_Extensions.h"
11 // ******************************************************************
13 // ******************************************************************
15 Notify_Structured_Push_Consumer::Notify_Structured_Push_Consumer (
17 unsigned int expected
,
18 Notify_Test_Client
& client
)
24 this->client_
.consumer_start (this);
29 Notify_Structured_Push_Consumer::_connect (
30 CosNotifyChannelAdmin::ConsumerAdmin_ptr consumer_admin
)
32 CosNotifyComm::StructuredPushConsumer_var objref
= this->_this ();
34 CosNotifyChannelAdmin::ProxySupplier_var proxysupplier
=
35 consumer_admin
->obtain_notification_push_supplier (
36 CosNotifyChannelAdmin::STRUCTURED_EVENT
,
40 CosNotifyChannelAdmin::StructuredProxyPushSupplier::_narrow (
43 this->proxy_
->connect_structured_push_consumer (objref
.in ());
45 CosNotification::EventTypeSeq
added (1);
46 CosNotification::EventTypeSeq
removed (1);
50 added
[0].domain_name
= CORBA::string_dup ("*");
51 added
[0].type_name
= CORBA::string_dup ("examples");
53 removed
[0].domain_name
= CORBA::string_dup ("*");
54 removed
[0].type_name
= CORBA::string_dup ("*");
56 this->subscription_change (added
, removed
);
58 // give ownership to POA
64 Notify_Structured_Push_Consumer::push_structured_event (
65 const CosNotification::StructuredEvent
&)
67 ACE_DEBUG ((LM_DEBUG
, "-"));
68 static const ACE_Time_Value
sl (1, 0);
71 if (this->count_
> this->expected_
)
74 ACE_TEXT ("Structured Consumer (%P|%t): ERROR: too ")
75 ACE_TEXT ("many events received.\n")));
78 if (this->count_
>= this->expected_
)
80 ACE_DEBUG ((LM_DEBUG
, "\nConsumer received %u events.\n", count_
));
81 this->client_
.consumer_done (this);