Forum Discussion
How to use EventSubscription and EventNotification with iControl.jar
If Big_Ip load balance manage a pool,the pool has 2 members,How to use EventSubscription and EventNotification with iControl.jar when some changes happened in one member and this event notification should send to another member.
How to use EventSubscription and EventNotification to realize it?
my program is like as fellows:
m_endpoint = https://userName:password:Load_Balance's_ip:port/iControl/iControlPortal.cgi
eventSubscription =(ManagementEventSubscriptionBindingStub)
(new ManagementEventSubscriptionLocator()).getManagementEventSubscriptionPort(new java.net.URL ( m_endpoint ));
eventSubscription.setTimeout ( 60000 ) ;
eventNotification =(ManagementEventNotificationBindingStub)
(new ManagementEventNotificationLocator()).getManagementEventNotificationPort(new java.net.URL ( m_endpoint ));
ManagementEventSubscriptionSubscriptionStatus[] subs_state = eventSubscription.create(sub_detail_list);
but how to use EventNotification and events_occurred(),how to wait for a notification?? Do we use ServerSocket(port 8080) to wait for notification?
and once we received the notification,we use EventNotification.events_occurred() to deal with the data????
Great thanks!
8 Replies
- Your code for the subscription creation looks good. When events occur, they will be sent to the URL you specify in the subscription information. Have you tested your endpoint to ensure it can take a webservice call? I've included in the SDK a perl sample client (EventNotificationClient.pl) that you can use on your BIG-IP (if you don't have the perl environment on a test machine) to send a sample message to an endpoint to test that it's configured properly to receive web service calls.
I honestly haven't done much with the java listening piece of things. If you have verified that the your endpoint works, you might want to run a tcpdump to try to see if any traffic is getting transmitted.
If all else fails, you can run the event daemon on the BIG-IP in debug mode$ bigstart shutdown eventd
$ /bin/eventd -d -f -o
This will run the event daemon in console mode with all debug information printed to the console. This should shed some light as to what is going on.
To get the event daemon back in daemon mode break out of the user mode running and type the following$ bigstart startup eventd
-Joe - Allen_Mao_3723
Nimbostratus
Hi,joe
I still have a problem,how to simulate events occurred? I shall test my endpoint to ensure it can take a webservice call. - Allen_Mao_3723
Nimbostratus
Before I run the event daemon on the BIG-IP in debug mode
I have deployed webservice on one machine"10.0.1.34",then
I run my subscription on another machine"10.0.1.33",and return the subscriptionID"A8A986D9-1974-6756-6247-0150A07139C2"
then I run the event daemon on the BIG-IP in debug mode
Some logs are as follows:
processSOAPMessage()
ns: urn:iControl:Management/EventSubscription
name: get_list
processSOAPMessage()
ns: urn:iControl:Management/EventSubscription
name: remove
Destroying Consumer 78186C0A-1974-7CB7-0E51-579E7D94E3E3
Saving Consumer list
******** Begin Memory Dump ********
Total Memory Used By Subscriptions: 0 Bytes
******** End Memory Dump ********
processSOAPMessage()
ns: urn:iControl:Management/EventSubscription
name: get_list
processSOAPMessage()
ns: urn:iControl:Management/EventSubscription
name: create
Creating Consumer E263EDF9-1974-ABEA-9046-B0D7A2B7442B
Saving Consumer list
Received TRANSACTION!
processSOAPMessage()
ns: urn:iControl:Management/EventSubscription
name: get_list
Received TRANSACTION!
MCPSerializer::serialize - operation 2908 (modify); object 2122(db_variable)
MCPSerializer::addData(), db_variable_name : string
MCPSerializer::addData(), db_variable_value : string
adding event to consumer E263EDF9-1974-ABEA-9046-B0D7A2B7442B
Received TRANSACTION!
MCPSerializer::serialize - operation 2908 (modify); object 944(pool_member)
MCPSerializer::addData(), pool_member_pool_name : string
MCPSerializer::addData(), pool_member_addr : ip_address
MCPSerializer::addData(), pool_member_port : service
MCPSerializer::addData(), pool_member_monitor_status : ulong
MCPSerializer::addData(), pool_member_session_status : ulong
adding event to consumer E263EDF9-1974-ABEA-9046-B0D7A2B7442B
MCPSerializer::serialize - operation 2908 (modify); object 944(pool_member)
MCPSerializer::addData(), pool_member_pool_name : string
MCPSerializer::addData(), pool_member_addr : ip_address
MCPSerializer::addData(), pool_member_port : service
MCPSerializer::addData(), pool_member_monitor_status : ulong
MCPSerializer::addData(), pool_member_session_status : ulong
adding event to consumer E263EDF9-1974-ABEA-9046-B0D7A2B7442B
MCPSerializer::serialize - operation 2908 (modify); object 944(pool_member)
MCPSerializer::addData(), pool_member_pool_name : string
MCPSerializer::addData(), pool_member_addr : ip_address
MCPSerializer::addData(), pool_member_port : service
MCPSerializer::addData(), pool_member_monitor_status : ulong
MCPSerializer::addData(), pool_member_session_status : ulong
adding event to consumer E263EDF9-1974-ABEA-9046-B0D7A2B7442B
MCPSerializer::serialize - operation 2908 (modify); object 944(pool_member)
MCPSerializer::addData(), pool_member_pool_name : string
MCPSerializer::addData(), pool_member_addr : ip_address
MCPSerializer::addData(), pool_member_port : service
MCPSerializer::addData(), pool_member_monitor_status : ulong
MCPSerializer::addData(), pool_member_session_status : ulong
adding event to consumer E263EDF9-1974-ABEA-9046-B0D7A2B7442B
MCPSerializer::serialize - operation 2908 (modify); object 944(pool_member)
MCPSerializer::addData(), pool_member_pool_name : string
MCPSerializer::addData(), pool_member_addr : ip_address
MCPSerializer::addData(), pool_member_port : service
MCPSerializer::addData(), pool_member_monitor_status : ulong
MCPSerializer::addData(), pool_member_session_status : ulong
adding event to consumer E263EDF9-1974-ABEA-9046-B0D7A2B7442B
MCPSerializer::serialize - operation 2908 (modify); object 944(pool_member)
MCPSerializer::addData(), pool_member_pool_name : string
MCPSerializer::addData(), pool_member_addr : ip_address
MCPSerializer::addData(), pool_member_port : service
MCPSerializer::addData(), pool_member_monitor_status : ulong
MCPSerializer::addData(), pool_member_session_status : ulong
adding event to consumer E263EDF9-1974-ABEA-9046-B0D7A2B7442B
MCPSerializer::serialize - operation 2908 (modify); object 944(pool_member)
MCPSerializer::addData(), pool_member_pool_name : string
MCPSerializer::addData(), pool_member_addr : ip_address
MCPSerializer::addData(), pool_member_port : service
MCPSerializer::addData(), pool_member_monitor_status : ulong
MCPSerializer::addData(), pool_member_session_status : ulong
adding event to consumer E263EDF9-1974-ABEA-9046-B0D7A2B7442B
MCPSerializer::serialize - operation 2908 (modify); object 2122(db_variable)
MCPSerializer::addData(), db_variable_name : string
MCPSerializer::addData(), db_variable_value : string
adding event to consumer E263EDF9-1974-ABEA-9046-B0D7A2B7442B
Received TRANSACTION!
MCPSerializer::serialize - operation 2908 (modify); object 2122(db_variable)
MCPSerializer::addData(), db_variable_name : string
MCPSerializer::addData(), db_variable_value : string
adding event to consumer E263EDF9-1974-ABEA-9046-B0D7A2B7442B
******** Begin Memory Dump ********
Consumer E263EDF9-1974-ABEA-9046-B0D7A2B7442B: overhead 1471 bytes
List[000] - Attrs: {48,22}; Total: 78 bytes
List[001] - Attrs: {32,29,22,31,31}; Total: 153 bytes
List[002] - Attrs: {33,29,24,31,31}; Total: 156 bytes
List[003] - Attrs: {37,29,24,31,31}; Total: 160 bytes
List[004] - Attrs: {38,29,21,31,31}; Total: 158 bytes
List[005] - Attrs: {32,29,22,31,31}; Total: 153 bytes
List[006] - Attrs: {32,29,24,31,31}; Total: 155 bytes
List[007] - Attrs: {37,29,24,31,31}; Total: 160 bytes
List[008] - Attrs: {46,31}; Total: 85 bytes
List[009] - Attrs: {48,22}; Total: 78 bytes
Total Memory: 2807 bytes
Total Memory2: 3688 bytes
Total Memory Used By Subscriptions: 2807 Bytes
******** End Memory Dump ********
Processing consumer: 'E263EDF9-1974-ABEA-9046-B0D7A2B7442B'
+ objects: 10; time (t0,t1,delta): (1181017792, 1181017792, 0)
Exiting MCPSubscriber Thread...
SOAPException on notification attempt: Timed out waiting for socket read.
******** Begin Memory Dump ********
Consumer E263EDF9-1974-ABEA-9046-B0D7A2B7442B: overhead 1471 bytes
List[000] - Attrs: {48,22}; Total: 78 bytes
List[001] - Attrs: {32,29,22,31,31}; Total: 153 bytes
List[002] - Attrs: {33,29,24,31,31}; Total: 156 bytes
List[003] - Attrs: {37,29,24,31,31}; Total: 160 bytes
List[004] - Attrs: {38,29,21,31,31}; Total: 158 bytes
List[005] - Attrs: {32,29,22,31,31}; Total: 153 bytes
List[006] - Attrs: {32,29,24,31,31}; Total: 155 bytes
List[007] - Attrs: {37,29,24,31,31}; Total: 160 bytes
List[008] - Attrs: {46,31}; Total: 85 bytes
List[009] - Attrs: {48,22}; Total: 78 bytes
Total Memory: 2807 bytes
Total Memory2: 3688 bytes
Total Memory Used By Subscriptions: 2807 Bytes
******** End Memory Dump ********
Processing consumer: 'E263EDF9-1974-ABEA-9046-B0D7A2B7442B'
+ objects: 10; time (t0,t1,delta): (1181017792, 1181017817, 25)
for what reason there is a SOAPException:SOAPException on notification attempt: Timed out waiting for socket read.
another question: The value of min_events_per_timeslice should i set what? - Allen_Mao_3723
Nimbostratus
SOrry,subscriptionID"A8A986D9-1974-6756-6247-0150A07139C2" should be "E263EDF9-1974-ABEA-9046-B0D7A2B7442B
" - Allen_Mao_3723
Nimbostratus
OK,The problem has been solved,many thanks - Glad to hear it! Sorry I didn't get back to you sooner, I've been out of town at a Conference this week and I haven't had much time to sit down and look at posts.
-Joe - sanjew_111035
Nimbostratus
what was fix Allen, currently i am facing similar issue, is there a way test the event notification via rest.
- dnoxs
Nimbostratus
Hi,
Is there support for EventSubscription through the iControl REST APIs?
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
