svn commit: r691574 - in /webservices/sandesha/trunk/c: include/sandesha2_client.h samples/rm_echo_1_1/rm_echo_1_1.c samples/rm_echo_single_1_1/rm_echo_single_1_1.c samples/rm_ping_1_1/rm_ping_1_1.c src/client/client.c

[email protected]
Newsgroups gmane.comp.apache.webservices.fx.devel
Message-ID <[email protected]>
Author: damitha
Date: Wed Sep  3 04:15:52 2008
New Revision: 691574

URL: http://svn.apache.org/viewvc?rev=691574&view=rev
Log:
Now last msg number in rm 1-1 is calculated wihin sandesha2/C instead of passing from application client

Modified:
    webservices/sandesha/trunk/c/include/sandesha2_client.h
    webservices/sandesha/trunk/c/samples/rm_echo_1_1/rm_echo_1_1.c
    webservices/sandesha/trunk/c/samples/rm_echo_single_1_1/rm_echo_single_1_1.c
    webservices/sandesha/trunk/c/samples/rm_ping_1_1/rm_ping_1_1.c
    webservices/sandesha/trunk/c/src/client/client.c

Modified: webservices/sandesha/trunk/c/include/sandesha2_client.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/include/sandesha2_client.h?rev=691574&r1=691573&r2=691574&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/include/sandesha2_client.h (original)
+++ webservices/sandesha/trunk/c/include/sandesha2_client.h Wed Sep  3 04:15:52 2008
@@ -112,15 +112,13 @@
 sandesha2_client_terminate_seq_with_svc_client(
     const axutil_env_t *env,
     axis2_svc_client_t *svc_client,
-    axis2_callback_t *callback,
-    long last_msg_no);
+    axis2_callback_t *callback);
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 sandesha2_client_terminate_seq_with_svc_client_and_seq_key(
     const axutil_env_t *env,
     axis2_svc_client_t *svc_client,
-    axis2_char_t *seq_key,
-    long last_msg_no);
+    axis2_char_t *seq_key);
 
 /**
  * User can close the seq defined by the passed svc_client.
@@ -131,15 +129,13 @@
 sandesha2_client_close_seq_with_svc_client(
     const axutil_env_t *env,
     axis2_svc_client_t *svc_client,
-    axis2_callback_t *callback,
-    long last_msg_num);
+    axis2_callback_t *callback);
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 sandesha2_client_close_seq_with_svc_client_and_seq_key(
     const axutil_env_t *env,
     axis2_svc_client_t *svc_client,
-    axis2_char_t *seq_key,
-    long last_msg_num);
+    axis2_char_t *seq_key);
 
 /**
  * This blocks the system until the messages sent have been completed.

Modified: webservices/sandesha/trunk/c/samples/rm_echo_1_1/rm_echo_1_1.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/rm_echo_1_1/rm_echo_1_1.c?rev=691574&r1=691573&r2=691574&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/samples/rm_echo_1_1/rm_echo_1_1.c (original)
+++ webservices/sandesha/trunk/c/samples/rm_echo_1_1/rm_echo_1_1.c Wed Sep  3 04:15:52 2008
@@ -202,7 +202,7 @@
     callback3 = axis2_callback_create(env);
     axis2_callback_set_on_complete(callback3, rm_echo_callback_on_complete);
     axis2_callback_set_on_error(callback3, rm_echo_callback_on_error);
-    sandesha2_client_terminate_seq_with_svc_client(env, svc_client, callback3, 2);
+    sandesha2_client_terminate_seq_with_svc_client(env, svc_client, callback3);
 
     AXIS2_SLEEP(SANDESHA2_MAX_COUNT);
 

Modified: webservices/sandesha/trunk/c/samples/rm_echo_single_1_1/rm_echo_single_1_1.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/rm_echo_single_1_1/rm_echo_single_1_1.c?rev=691574&r1=691573&r2=691574&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/samples/rm_echo_single_1_1/rm_echo_single_1_1.c (original)
+++ webservices/sandesha/trunk/c/samples/rm_echo_single_1_1/rm_echo_single_1_1.c Wed Sep  3 04:15:52 2008
@@ -244,7 +244,7 @@
 
     AXIS2_SLEEP(SANDESHA2_SLEEP); 
 
-    sandesha2_client_terminate_seq_with_svc_client_and_seq_key(env, svc_client, seq_key, 3);
+    sandesha2_client_terminate_seq_with_svc_client_and_seq_key(env, svc_client, seq_key);
 
     AXIS2_SLEEP(6 * SANDESHA2_SLEEP);
 

Modified: webservices/sandesha/trunk/c/samples/rm_ping_1_1/rm_ping_1_1.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/rm_ping_1_1/rm_ping_1_1.c?rev=691574&r1=691573&r2=691574&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/samples/rm_ping_1_1/rm_ping_1_1.c (original)
+++ webservices/sandesha/trunk/c/samples/rm_ping_1_1/rm_ping_1_1.c Wed Sep  3 04:15:52 2008
@@ -155,7 +155,7 @@
         printf("\nping client invoke SUCCESSFUL!\n");
     AXIS2_SLEEP(MAX_COUNT);
     
-    sandesha2_client_terminate_seq_with_svc_client(env, svc_client, NULL, 3);
+    sandesha2_client_terminate_seq_with_svc_client(env, svc_client, NULL);
      /** Wait till callback is complete. Simply keep the parent thread running
        until our on_complete or on_error is invoked */
 

Modified: webservices/sandesha/trunk/c/src/client/client.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/client/client.c?rev=691574&r1=691573&r2=691574&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/client/client.c (original)
+++ webservices/sandesha/trunk/c/src/client/client.c Wed Sep  3 04:15:52 2008
@@ -82,8 +82,7 @@
 sandesha2_client_configure_close_seq(
         const axutil_env_t *env,
         axis2_options_t *options, 
-        axis2_conf_ctx_t *conf_ctx,
-        long last_msg_num);
+        axis2_conf_ctx_t *conf_ctx);
 
 static axis2_bool_t
 sandesha2_client_is_seq_terminated(
@@ -135,8 +134,7 @@
     const axutil_env_t *env,
     axis2_options_t *options, 
     axis2_conf_ctx_t *conf_ctx,
-    sandesha2_seq_property_mgr_t *seq_prop_mgr,
-    long last_msg_num);
+    sandesha2_seq_property_mgr_t *seq_prop_mgr);
 
 static axis2_bool_t
 fill_soap_envelope(
@@ -611,8 +609,7 @@
 sandesha2_client_terminate_seq_with_svc_client(
     const axutil_env_t *env,
     axis2_svc_client_t *svc_client,
-    axis2_callback_t *callback,
-    long last_msg_num)
+    axis2_callback_t *callback)
 {
     axis2_svc_ctx_t *svc_ctx = NULL;
     axis2_options_t *options = NULL;
@@ -675,7 +672,7 @@
     }
 
     terminate_envelope = sandesha2_client_configure_terminate_seq(env, options, conf_ctx, 
-            seq_prop_mgr, last_msg_num);
+            seq_prop_mgr);
 
     if (!terminate_envelope)
     {
@@ -770,8 +767,7 @@
 sandesha2_client_terminate_seq_with_svc_client_and_seq_key(
     const axutil_env_t *env,
     axis2_svc_client_t *svc_client,
-    axis2_char_t *seq_key,
-    long last_msg_num)
+    axis2_char_t *seq_key)
 {
     axis2_options_t *options = NULL;
     axutil_property_t *property = NULL;
@@ -789,7 +785,7 @@
 
     property = axutil_property_create_with_args(env, 0, 0, 0, seq_key);
     axis2_options_set_property(options, env, SANDESHA2_CLIENT_SEQ_KEY, property);
-    sandesha2_client_terminate_seq_with_svc_client(env, svc_client, NULL, last_msg_num);
+    sandesha2_client_terminate_seq_with_svc_client(env, svc_client, NULL);
     axis2_options_set_property(options, env, SANDESHA2_CLIENT_SEQ_KEY, old_property);
     return AXIS2_SUCCESS;
 }
@@ -803,8 +799,7 @@
 sandesha2_client_close_seq_with_svc_client(
     const axutil_env_t *env,
     axis2_svc_client_t *svc_client,
-    axis2_callback_t *callback,
-    long last_msg_num)
+    axis2_callback_t *callback)
 {
     axis2_svc_ctx_t *svc_ctx = NULL;
     axis2_options_t *options = NULL;
@@ -854,7 +849,7 @@
 
     rm_namespc_value = sandesha2_spec_specific_consts_get_rm_ns_val(env, rm_spec_version);
     conf_ctx =  axis2_svc_ctx_get_conf_ctx(svc_ctx, env);
-    close_envelope = sandesha2_client_configure_close_seq(env, options, conf_ctx, last_msg_num);
+    close_envelope = sandesha2_client_configure_close_seq(env, options, conf_ctx);
     body = axiom_soap_envelope_get_body(close_envelope, env);
     node = axiom_soap_body_get_base_node(body, env);
     element = axiom_node_get_data_element(node, env);
@@ -894,8 +889,7 @@
 sandesha2_client_close_seq_with_svc_client_and_seq_key(
     const axutil_env_t *env,
     axis2_svc_client_t *svc_client,
-    axis2_char_t *seq_key,
-    long last_msg_num)
+    axis2_char_t *seq_key)
 {
     axis2_options_t *options = NULL;
     axutil_property_t *property = NULL;
@@ -918,7 +912,7 @@
 
     property = axutil_property_create_with_args(env, 0, 0, 0, seq_key);
     axis2_options_set_property(options, env, SANDESHA2_CLIENT_SEQ_KEY, property);
-    sandesha2_client_close_seq_with_svc_client(env, svc_client, NULL, last_msg_num);
+    sandesha2_client_close_seq_with_svc_client(env, svc_client, NULL);
     axis2_options_set_property(options, env, SANDESHA2_CLIENT_SEQ_KEY, old_property);
 
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
@@ -1303,8 +1297,7 @@
 sandesha2_client_configure_close_seq(
     const axutil_env_t *env,
     axis2_options_t *options, 
-    axis2_conf_ctx_t *conf_ctx,
-    long last_msg_num)
+    axis2_conf_ctx_t *conf_ctx)
 {
     axis2_endpoint_ref_t *to_epr = NULL;
     axis2_char_t *to = NULL;
@@ -1321,11 +1314,11 @@
     axis2_char_t *rm_spec_version = NULL;
     axiom_soap_envelope_t *dummy_envelope = NULL;
     sandesha2_identifier_t *identifier = NULL;
-    sandesha2_last_msg_number_t *last_msg_number = NULL;
     sandesha2_seq_report_t *seq_report = NULL;
     axis2_conf_t *conf = NULL;
     axutil_property_t *property = NULL;
     axis2_char_t *dbname = NULL;
+    sandesha2_seq_property_bean_t *last_out_msg_no_bean = NULL;
 
     if(!options)
     {
@@ -1450,9 +1443,32 @@
     identifier = sandesha2_identifier_create(env, rm_ns_value);
     sandesha2_identifier_set_identifier(identifier, env, seq_id);
     sandesha2_close_seq_set_identifier(close_seq, env, identifier);
-    last_msg_number = sandesha2_last_msg_number_create(env, rm_ns_value);
-    sandesha2_last_msg_number_set_last_msg_number(last_msg_number, env, last_msg_num);
-    sandesha2_close_seq_set_last_msg_number(close_seq, env, last_msg_number);
+
+    last_out_msg_no_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, 
+        internal_seq_id, SANDESHA2_SEQ_PROP_LAST_OUT_MESSAGE_NUMBER);
+    if(last_out_msg_no_bean)
+    {
+        axis2_char_t *last_msg_num_str = NULL;
+
+        last_msg_num_str = sandesha2_seq_property_bean_get_value(last_out_msg_no_bean, env);
+        if(last_msg_num_str)
+        {
+            sandesha2_last_msg_number_t *last_msg_number = NULL;
+            
+            last_msg_number = sandesha2_last_msg_number_create(env, rm_ns_value);
+            if(last_msg_number)
+            {
+                long last_msg_num = -1;
+
+                AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "last msg no:%s", last_msg_num_str);
+                last_msg_num = axutil_atol(last_msg_num_str);
+                
+                sandesha2_last_msg_number_set_last_msg_number(last_msg_number, env, last_msg_num);
+                sandesha2_close_seq_set_last_msg_number(close_seq, env, last_msg_number);
+            }
+        }
+    }
+
     sandesha2_close_seq_to_soap_envelope(close_seq, env, dummy_envelope);
 
     if(seq_prop_mgr)
@@ -1731,8 +1747,7 @@
     const axutil_env_t *env,
     axis2_options_t *options, 
     axis2_conf_ctx_t *conf_ctx,
-    sandesha2_seq_property_mgr_t *seq_prop_mgr,
-    long last_msg_num)
+    sandesha2_seq_property_mgr_t *seq_prop_mgr)
 {
     axis2_endpoint_ref_t *to_epr = NULL;
     axis2_char_t *to = NULL;
@@ -1793,8 +1808,8 @@
         sandesha2_terminate_seq_t *terminate_seq = NULL;
         sandesha2_identifier_t *identifier = NULL;
         sandesha2_seq_property_bean_t *seq_id_bean = NULL;
-        sandesha2_last_msg_number_t *last_msg_number = NULL;
         axis2_char_t *seq_id = NULL;
+        sandesha2_seq_property_bean_t *last_out_msg_no_bean = NULL;
 
         conf = axis2_conf_ctx_get_conf(conf_ctx, env);
     
@@ -1856,11 +1871,30 @@
             sandesha2_terminate_seq_set_identifier(terminate_seq, env, identifier);
         }
 
-        last_msg_number = sandesha2_last_msg_number_create(env, rm_ns_value);
-        if(last_msg_number)
-        {
-            sandesha2_last_msg_number_set_last_msg_number(last_msg_number, env, last_msg_num);
-            sandesha2_terminate_seq_set_last_msg_number(terminate_seq, env, last_msg_number);
+        last_out_msg_no_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, 
+            internal_seq_id, SANDESHA2_SEQ_PROP_LAST_OUT_MESSAGE_NUMBER);
+
+        if(last_out_msg_no_bean)
+        { 
+            axis2_char_t *last_msg_num_str = NULL;
+
+            last_msg_num_str = sandesha2_seq_property_bean_get_value(last_out_msg_no_bean, env);
+            if(last_msg_num_str)
+            {
+                sandesha2_last_msg_number_t *last_msg_number = NULL;
+
+                last_msg_number = sandesha2_last_msg_number_create(env, rm_ns_value);
+                if(last_msg_number)
+                {
+                    long last_msg_num = -1;
+
+                    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "last msg no:%s", last_msg_num_str);
+                    last_msg_num = axutil_atol(last_msg_num_str);
+
+                    sandesha2_last_msg_number_set_last_msg_number(last_msg_number, env, last_msg_num);
+                    sandesha2_terminate_seq_set_last_msg_number(terminate_seq, env, last_msg_number);
+                }
+            }
         }
 
         sandesha2_terminate_seq_to_soap_envelope(terminate_seq, env, dummy_envelope);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.