ws-sandesha-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dami...@apache.org
Subject svn commit: r690127 [5/11] - in /webservices/sandesha/trunk/c: ./ build/win32/ config/ ides/vc8/sandesha2/sandesha2/ include/ include/sandesha2/ samples/ samples/RMSampleService/ samples/rm_echo_1_0/ samples/rm_echo_1_0_large_sequence/ samples/rm_echo_...
Date Fri, 29 Aug 2008 06:56:38 GMT
Modified: webservices/sandesha/trunk/c/src/msgprocessors/create_seq_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/create_seq_msg_processor.c?rev=690127&r1=690126&r2=690127&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/create_seq_msg_processor.c (original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/create_seq_msg_processor.c Thu Aug 28 23:56:29 2008
@@ -62,7 +62,6 @@
 #define SANDESHA2_INTF_TO_IMPL(msg_proc) \
 						((sandesha2_create_seq_msg_processor_impl_t *)(msg_proc))
 
-/***************************** Function headers *******************************/
 static axis2_status_t AXIS2_CALL 
 sandesha2_create_seq_msg_processor_process_in_msg (
     sandesha2_msg_processor_t *msg_processor,
@@ -75,6 +74,14 @@
     const axutil_env_t *env, 
     sandesha2_msg_ctx_t *rm_msg_ctx);
     
+static axis2_status_t AXIS2_CALL 
+sandesha2_create_seq_msg_processor_create_seq_msg_already_received(
+    const axutil_env_t *env, 
+    axis2_char_t *seq_id,
+    sandesha2_msg_ctx_t *rm_msg_ctx,
+    sandesha2_create_seq_mgr_t *create_seq_mgr,
+    sandesha2_seq_property_mgr_t *seq_property_mgr);
+
 static axis2_bool_t AXIS2_CALL 
 sandesha2_create_seq_msg_processor_offer_accepted(
     const axutil_env_t *env, 
@@ -87,8 +94,6 @@
     sandesha2_msg_processor_t *msg_processor, 
     const axutil_env_t *env);								
 
-/***************************** End of function headers ************************/
-
 AXIS2_EXTERN sandesha2_msg_processor_t* AXIS2_CALL
 sandesha2_create_seq_msg_processor_create(
     const axutil_env_t *env)
@@ -149,7 +154,7 @@
     const axutil_env_t *env,
     sandesha2_msg_ctx_t *rm_msg_ctx)
 {
-    axis2_msg_ctx_t *msg_ctx = NULL;
+    axis2_msg_ctx_t *create_seq_msg_ctx = NULL;
     sandesha2_create_seq_t *create_seq_part = NULL;
     axis2_conf_ctx_t *conf_ctx = NULL;
     sandesha2_msg_ctx_t *fault_rm_msg_ctx = NULL;
@@ -157,8 +162,8 @@
     sandesha2_seq_property_mgr_t *seq_prop_mgr = NULL;
     sandesha2_next_msg_mgr_t *next_msg_mgr = NULL;
     axutil_property_t *property = NULL;
-    axis2_char_t *new_seq_id = NULL;
-    sandesha2_msg_ctx_t *create_seq_res_msg = NULL;
+    axis2_char_t *rmd_sequence_id = NULL;
+    sandesha2_msg_ctx_t *rm_create_seq_res_msg_ctx = NULL;
     sandesha2_create_seq_res_t *create_seq_res_part = NULL;
     sandesha2_seq_offer_t *seq_offer = NULL;
     axis2_endpoint_ref_t *acks_to = NULL;
@@ -167,211 +172,347 @@
     axis2_engine_t *engine = NULL;
     axis2_char_t *addr_ns_uri = NULL;
     axis2_char_t *anon_uri = NULL;
-    axis2_endpoint_ref_t *to_epr = NULL;
+    axis2_char_t *to_addr = NULL;
     axis2_op_ctx_t *op_ctx = NULL;
     axis2_char_t *dbname = NULL;
     sandesha2_create_seq_mgr_t *create_seq_mgr = NULL;
+    axis2_msg_ctx_t **msg_ctx_map = NULL;
      
-    AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE);
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,  
         "[sandesha2] Start:sandesha2_create_seq_msg_processor_process_in_msg");
     
-    msg_ctx = sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env);
+    AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE);
+    
+    create_seq_msg_ctx = sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env);
+    
+    op_ctx = axis2_msg_ctx_get_op_ctx(create_seq_msg_ctx, env);
+    msg_ctx_map = axis2_op_ctx_get_msg_ctx_map(op_ctx, env);
+    msg_ctx_map[AXIS2_WSDL_MESSAGE_LABEL_IN] = create_seq_msg_ctx;
+
     create_seq_part = sandesha2_msg_ctx_get_create_seq(rm_msg_ctx, env);
     if(!create_seq_part)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]create_seq_part"
-            " is NULL");
-        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_REQD_MSG_PART_MISSING,
-                        AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] create_seq_part is NULL");
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_REQD_MSG_PART_MISSING, AXIS2_FAILURE);
         return AXIS2_FAILURE;
     }
-    conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
+
+    conf_ctx = axis2_msg_ctx_get_conf_ctx(create_seq_msg_ctx, env);
     dbname = sandesha2_util_get_dbname(env, conf_ctx);
     seq_prop_mgr = sandesha2_permanent_seq_property_mgr_create(env, dbname);
     create_seq_mgr = sandesha2_permanent_create_seq_mgr_create(env, dbname);
     next_msg_mgr = sandesha2_permanent_next_msg_mgr_create(env, dbname);
     
-    fault_rm_msg_ctx = sandesha2_fault_mgr_check_for_create_seq_refused(
-        env, msg_ctx, seq_prop_mgr);
+    /*fault_rm_msg_ctx = sandesha2_fault_mgr_check_for_create_seq_refused(env, rm_msg_ctx, seq_prop_mgr);*/
+    fault_rm_msg_ctx = sandesha2_fault_mgr_check_for_create_seq_refused(env, rm_msg_ctx, seq_prop_mgr);
     if(fault_rm_msg_ctx)
     {
         axis2_engine_t *engine = NULL;
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "[sandesha2]A fault occurred"); 
+
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] A fault occurred"); 
+
         engine = axis2_engine_create(env, conf_ctx);
-        axis2_engine_send_fault(engine, env, sandesha2_msg_ctx_get_msg_ctx(
-            fault_rm_msg_ctx, env));
+        axis2_engine_send_fault(engine, env, sandesha2_msg_ctx_get_msg_ctx(fault_rm_msg_ctx, env));
         if(fault_rm_msg_ctx)
+        {
             sandesha2_msg_ctx_free(fault_rm_msg_ctx, env);
+        }
+
         if(engine)
         {
             axis2_engine_free(engine, env);
             engine = NULL;
         }
-        axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_TRUE);
+
+        axis2_msg_ctx_set_paused(create_seq_msg_ctx, env, AXIS2_TRUE);
+
         if(seq_prop_mgr)
+        {
             sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+        }
         if(create_seq_mgr)
+        {
             sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+        }
         if(next_msg_mgr)
+        {
             sandesha2_next_msg_mgr_free(next_msg_mgr, env);
+        }
+
         return AXIS2_SUCCESS;
     }
-    out_msg_ctx = sandesha2_utils_create_out_msg_ctx(env, msg_ctx);
-    new_seq_id = sandesha2_seq_mgr_setup_new_seq(env, rm_msg_ctx, seq_prop_mgr,
-        next_msg_mgr);
-    create_seq_res_msg = sandesha2_msg_creator_create_create_seq_res_msg(env,
-        rm_msg_ctx, out_msg_ctx, new_seq_id, seq_prop_mgr);
+
+    out_msg_ctx = sandesha2_utils_create_out_msg_ctx(env, create_seq_msg_ctx);
+
+    rmd_sequence_id = sandesha2_seq_mgr_setup_new_rmd_sequence(env, rm_msg_ctx, seq_prop_mgr, 
+            next_msg_mgr);
+
+    rm_create_seq_res_msg_ctx = sandesha2_msg_creator_create_create_seq_res_msg(env, rm_msg_ctx, 
+            out_msg_ctx, rmd_sequence_id, seq_prop_mgr);
+
     axis2_msg_ctx_set_flow(out_msg_ctx, env, AXIS2_OUT_FLOW);
-    if(!create_seq_res_msg)
+
+    if(!rm_create_seq_res_msg_ctx)
     {
+        if(rmd_sequence_id)
+        {
+            AXIS2_FREE(env->allocator, rmd_sequence_id);
+        }
+
         if(seq_prop_mgr)
+        {
             sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+        }
+
         if(create_seq_mgr)
+        {
             sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+        }
+
         if(next_msg_mgr)
+        {
             sandesha2_next_msg_mgr_free(next_msg_mgr, env);
+        }
+
         return AXIS2_FAILURE;
     }
-    property = axutil_property_create_with_args(env, 0, 0, 0, 
-        AXIS2_VALUE_TRUE);
+
+    property = axutil_property_create_with_args(env, 0, 0, 0, AXIS2_VALUE_TRUE);
+
     /* For making sure that this won't be processed again */
-    sandesha2_msg_ctx_set_property(create_seq_res_msg, env, 
-        SANDESHA2_APPLICATION_PROCESSING_DONE, property); 
+    sandesha2_msg_ctx_set_property(rm_create_seq_res_msg_ctx, env, 
+            SANDESHA2_APPLICATION_PROCESSING_DONE, property); 
     
-    create_seq_res_part = sandesha2_msg_ctx_get_create_seq_res(
-        create_seq_res_msg, env);
-    seq_offer = sandesha2_create_seq_get_seq_offer(create_seq_part, 
-                        env);
+    create_seq_res_part = sandesha2_msg_ctx_get_create_seq_res(rm_create_seq_res_msg_ctx, env);
+    seq_offer = sandesha2_create_seq_get_seq_offer(create_seq_part, env);
+
     /* Offer processing */ 
     if(seq_offer)
     {
         sandesha2_accept_t *accept = NULL;
-        axis2_char_t *offer_seq_id = NULL;
+        axis2_char_t *rms_sequence_id = NULL;
         axis2_bool_t offer_accepted = AXIS2_FALSE;
 
-        if(create_seq_res_part) 
+        if(create_seq_res_part)
+        {
             accept = sandesha2_create_seq_res_get_accept(create_seq_res_part, env);
+        }
         if(!accept)
         {
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]Accept part "
-                "has not genereated for a message with offer");
-            AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_REQD_MSG_PART_MISSING,
-                 AXIS2_FAILURE);
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+                    "[sandesha2] Accept part has not genereated for a message with offer");
+            AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_REQD_MSG_PART_MISSING, AXIS2_FAILURE);
+
+            if(rm_create_seq_res_msg_ctx)
+            {
+                sandesha2_msg_ctx_free(rm_create_seq_res_msg_ctx, env);
+            }
+
+            if(rmd_sequence_id)
+            {
+                AXIS2_FREE(env->allocator, rmd_sequence_id);
+            }
+
             if(seq_prop_mgr)
+            {
                 sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+            }
+
             if(create_seq_mgr)
+            {
                 sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+            }
+
             if(next_msg_mgr)
+            {
                 sandesha2_next_msg_mgr_free(next_msg_mgr, env);
+            }
+
             return AXIS2_FAILURE;
         }
-        offer_seq_id = sandesha2_identifier_get_identifier(
-                        sandesha2_seq_offer_get_identifier(seq_offer, env), env);
-        offer_accepted = sandesha2_create_seq_msg_processor_offer_accepted(
-            env, offer_seq_id, rm_msg_ctx, create_seq_mgr);
+
+        rms_sequence_id = sandesha2_identifier_get_identifier(sandesha2_seq_offer_get_identifier(
+                    seq_offer, env), env);
+
+        /* Check whether offered sequence id is valid or create sequence bean already created */
+        offer_accepted = sandesha2_create_seq_msg_processor_offer_accepted(env, rms_sequence_id, 
+                rm_msg_ctx, create_seq_mgr);
+
         if(offer_accepted)
         {
-            sandesha2_create_seq_bean_t *create_seq_bean = NULL;
-            axis2_char_t *internal_seq_id = NULL;
-            sandesha2_seq_property_bean_t *out_seq_bean = NULL;
-            sandesha2_seq_property_bean_t *internal_seq_bean = NULL;
-    
-            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-                "[sandesha2] Offer Accepted"); 
-            create_seq_bean = sandesha2_create_seq_bean_create(env);
-            sandesha2_create_seq_bean_set_seq_id(create_seq_bean, env, 
-                        offer_seq_id);
-            internal_seq_id = sandesha2_utils_get_outgoing_internal_seq_id(env,
-                        new_seq_id);
-            sandesha2_create_seq_bean_set_internal_seq_id(create_seq_bean, env,
-                        internal_seq_id);
-            sandesha2_create_seq_bean_set_create_seq_msg_id(create_seq_bean, env,
-                        axutil_uuid_gen(env));
-            sandesha2_create_seq_mgr_insert(create_seq_mgr, env, create_seq_bean);
+            /*sandesha2_create_seq_bean_t *create_seq_bean = NULL;*/
+            axis2_char_t *rms_internal_seq_id = NULL;
+            sandesha2_seq_property_bean_t *rms_sequence_bean = NULL;
+            sandesha2_seq_property_bean_t *rms_internal_sequence_bean = NULL;
+    
+            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Offer Accepted"); 
+
+            /*
+             * If previously a create sequence message has arrived with an offer then there is
+             * a create sequence bean already created in the database. Free it. Also free
+             * rms_internal_sequence_bean, and rms_sequence_bean.
+             */
+            sandesha2_create_seq_msg_processor_create_seq_msg_already_received(env, rms_sequence_id, 
+                rm_msg_ctx, create_seq_mgr, seq_prop_mgr);
+
+            rms_internal_seq_id = sandesha2_utils_get_internal_sequence_id(env, rmd_sequence_id);
+
+            /*create_seq_bean = sandesha2_create_seq_bean_create(env);
+            sandesha2_create_seq_bean_set_rms_sequence_id(create_seq_bean, env, rms_sequence_id);
+            sandesha2_create_seq_bean_set_internal_sequence_id(create_seq_bean, env, 
+                    rms_internal_seq_id);
+
+            sandesha2_create_seq_bean_set_create_seq_msg_id(create_seq_bean, env, 
+                    axutil_uuid_gen(env));
+
+            sandesha2_create_seq_mgr_insert(create_seq_mgr, env, create_seq_bean);*/
             
-            out_seq_bean = sandesha2_seq_property_bean_create(env);
-            sandesha2_seq_property_bean_set_name(out_seq_bean, env, 
-                SANDESHA2_SEQ_PROP_OUT_SEQ_ID);
-            /*sandesha2_seq_property_bean_set_seq_id(out_seq_bean, env, 
-                internal_seq_id);*/
-            sandesha2_seq_property_bean_set_seq_id(out_seq_bean, env, 
-                internal_seq_id);
-            sandesha2_seq_property_bean_set_value(out_seq_bean, env, 
-                offer_seq_id);
-            sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, 
-                out_seq_bean);
-            internal_seq_bean = sandesha2_seq_property_bean_create(env);
-            sandesha2_seq_property_bean_set_name(internal_seq_bean, env, 
-                SANDESHA2_SEQ_PROP_INTERNAL_SEQ_ID);
-            sandesha2_seq_property_bean_set_seq_id(internal_seq_bean, env, 
-                offer_seq_id);
-            sandesha2_seq_property_bean_set_value(internal_seq_bean, env, 
-                internal_seq_id);
-            sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, 
-                internal_seq_bean);
+            rms_sequence_bean = sandesha2_seq_property_bean_create(env);
+            if(rms_sequence_bean)
+            {
+                sandesha2_seq_property_bean_set_name(rms_sequence_bean, env, SANDESHA2_SEQUENCE_PROPERTY_RMS_SEQ_ID);
+
+                sandesha2_seq_property_bean_set_seq_id(rms_sequence_bean, env, rms_internal_seq_id);
+                sandesha2_seq_property_bean_set_value(rms_sequence_bean, env, rms_sequence_id);
+                AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] rmd_sequence_id:%s", rmd_sequence_id); 
+                sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, rms_sequence_bean);
+                sandesha2_seq_property_bean_free(rms_sequence_bean, env);
+            }
+
+            rms_internal_sequence_bean = sandesha2_seq_property_bean_create(env);
+            if(rms_internal_sequence_bean)
+            {
+                sandesha2_seq_property_bean_set_name(rms_internal_sequence_bean, env, 
+                    SANDESHA2_SEQUENCE_PROPERTY_RMS_INTERNAL_SEQ_ID);
+
+                sandesha2_seq_property_bean_set_seq_id(rms_internal_sequence_bean, env, rms_sequence_id);
+                sandesha2_seq_property_bean_set_value(rms_internal_sequence_bean, env, rms_internal_seq_id);
+                sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, rms_internal_sequence_bean);
+                sandesha2_seq_property_bean_free(rms_internal_sequence_bean, env);
+            }
+
+            if(rms_internal_seq_id)
+            {
+                AXIS2_FREE(env->allocator, rms_internal_seq_id);
+            }
         }
         else
         {
-            sandesha2_create_seq_res_set_accept(create_seq_res_part, env, NULL);
-            sandesha2_msg_ctx_add_soap_envelope(create_seq_res_msg, env);
+            sandesha2_msg_ctx_add_soap_envelope(rm_create_seq_res_msg_ctx, env);
         }
     }
+
     acks_to = sandesha2_address_get_epr(sandesha2_acks_to_get_address(
-        sandesha2_create_seq_get_acks_to(create_seq_part, env), 
-        env), env);
-    if(!acks_to || !axis2_endpoint_ref_get_address(acks_to, 
-                    env))
+                sandesha2_create_seq_get_acks_to(create_seq_part, env), env), env);
+
+    if(!acks_to || !axis2_endpoint_ref_get_address(acks_to, env))
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]Acks to is null");
-        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_INVALID_EPR, 
-            AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_INVALID_EPR, AXIS2_FAILURE);
+
+        if(rm_create_seq_res_msg_ctx)
+        {
+            sandesha2_msg_ctx_free(rm_create_seq_res_msg_ctx, env);
+        }
+
+        if(rmd_sequence_id)
+        {
+            AXIS2_FREE(env->allocator, rmd_sequence_id);
+        }
+
         if(seq_prop_mgr)
+        {
             sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+        }
+
         if(create_seq_mgr)
+        {
             sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+        }
+
         if(next_msg_mgr)
+        {
             sandesha2_next_msg_mgr_free(next_msg_mgr, env);
+        }
+
         return AXIS2_FAILURE;
     }
-    acks_to_bean = sandesha2_seq_property_bean_create_with_data(env, 
-        new_seq_id, SANDESHA2_SEQ_PROP_ACKS_TO_EPR, 
-        (axis2_char_t*)axis2_endpoint_ref_get_address(acks_to, env));
-    sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, acks_to_bean);
-    op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
+
+    acks_to_bean = sandesha2_seq_property_bean_create_with_data(env, rmd_sequence_id, 
+            SANDESHA2_SEQ_PROP_ACKS_TO_EPR, (axis2_char_t*)axis2_endpoint_ref_get_address(acks_to, 
+                env));
+
+    if(acks_to_bean)
+    {
+        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, acks_to_bean);
+        sandesha2_seq_property_bean_free(acks_to_bean, env);
+    }
+
     axis2_op_ctx_set_response_written(op_ctx, env, AXIS2_TRUE);
-    sandesha2_seq_mgr_update_last_activated_time(env, new_seq_id, seq_prop_mgr);
+    sandesha2_seq_mgr_update_last_activated_time(env, rmd_sequence_id, seq_prop_mgr);
+
     engine = axis2_engine_create(env, conf_ctx);
+
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]axis2_engine_send");
+
     axis2_engine_send(engine, env, out_msg_ctx);
     if(engine)
+    {
         axis2_engine_free(engine, env);
-    to_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, 
-        new_seq_id, SANDESHA2_SEQ_PROP_TO_EPR);
+    }
+
+    if(out_msg_ctx)
+    {
+        axis2_core_utils_reset_out_msg_ctx(env, out_msg_ctx);
+        /*axis2_msg_ctx_reset_transport_out_stream(out_msg_ctx, env);*/
+        axis2_msg_ctx_free(out_msg_ctx, env);
+    }
+
+    if(rm_create_seq_res_msg_ctx)
+    {
+        sandesha2_msg_ctx_free(rm_create_seq_res_msg_ctx, env);
+    }
+
+    to_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, rmd_sequence_id, 
+            SANDESHA2_SEQ_PROP_TO_EPR);
     if(!to_bean)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]wsa:To is not set");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] wsa:To is not set");
+
+        if(rmd_sequence_id)
+        {
+            AXIS2_FREE(env->allocator, rmd_sequence_id);
+        }
+
         if(seq_prop_mgr)
+        {
             sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+        }
+
         if(create_seq_mgr)
+        {
             sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+        }
+
         if(next_msg_mgr)
+        {
             sandesha2_next_msg_mgr_free(next_msg_mgr, env);
+        }
+
         return AXIS2_FAILURE;
     }
-    to_epr = axis2_endpoint_ref_create(env, 
-        sandesha2_seq_property_bean_get_value(to_bean, env));
-    addr_ns_uri = sandesha2_utils_get_seq_property(env, new_seq_id, 
-        SANDESHA2_SEQ_PROP_ADDRESSING_NAMESPACE_VALUE,
-        seq_prop_mgr);
+
+    to_addr = sandesha2_seq_property_bean_get_value(to_bean, env);
+    addr_ns_uri = sandesha2_utils_get_seq_property(env, rmd_sequence_id, 
+            SANDESHA2_SEQ_PROP_ADDRESSING_NAMESPACE_VALUE, seq_prop_mgr);
+
     anon_uri = sandesha2_spec_specific_consts_get_anon_uri(env, addr_ns_uri);
     if(addr_ns_uri)
+    {
         AXIS2_FREE(env->allocator, addr_ns_uri);
+    }
     
-    op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
-    if(sandesha2_utils_is_anon_uri(env, axis2_endpoint_ref_get_address(to_epr, 
-        env)))
+    if(sandesha2_utils_is_anon_uri(env, to_addr))
     {
         axis2_op_ctx_set_response_written(op_ctx, env, AXIS2_TRUE);
     }
@@ -379,16 +520,35 @@
     {
         axis2_op_ctx_set_response_written(op_ctx, env, AXIS2_FALSE);
     }
-    
+
+    sandesha2_seq_property_bean_free(to_bean, env);
+   
+    /* Pausing the flow here so that it won't go to a message receiver which is not set for this flow */
     sandesha2_msg_ctx_set_paused(rm_msg_ctx, env, AXIS2_TRUE);
+
+    if(rmd_sequence_id)
+    {
+        AXIS2_FREE(env->allocator, rmd_sequence_id);
+    }
+
     if(seq_prop_mgr)
+    {
         sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+    }
+
     if(create_seq_mgr)
+    {
         sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+    }
+
     if(next_msg_mgr)
+    {
         sandesha2_next_msg_mgr_free(next_msg_mgr, env);
+    }
+
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,  
         "[sandesha2] Exit: sandesha2_create_seq_msg_processor_process_in_msg");
+
     return AXIS2_SUCCESS;
     
 }
@@ -407,6 +567,131 @@
     return AXIS2_SUCCESS;
 }
 
+static axis2_status_t AXIS2_CALL 
+sandesha2_create_seq_msg_processor_create_seq_msg_already_received(
+    const axutil_env_t *env, 
+    axis2_char_t *seq_id,
+    sandesha2_msg_ctx_t *rm_msg_ctx,
+    sandesha2_create_seq_mgr_t *create_seq_mgr,
+    sandesha2_seq_property_mgr_t *seq_property_mgr)
+{
+    sandesha2_seq_property_bean_t *find_seq_property_bean = NULL;
+    sandesha2_create_seq_bean_t *find_create_seq_bean = NULL;
+    axutil_array_list_t *list = NULL;
+    int size = 0;
+    
+    AXIS2_PARAM_CHECK(env->error, seq_id, AXIS2_FALSE);
+    AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FALSE);
+    AXIS2_PARAM_CHECK(env->error, create_seq_mgr, AXIS2_FALSE);
+    
+    find_create_seq_bean = sandesha2_create_seq_bean_create_with_data(env, NULL, NULL, seq_id);
+    if(find_create_seq_bean)
+    {
+        list = sandesha2_create_seq_mgr_find(create_seq_mgr, env, find_create_seq_bean);
+        sandesha2_create_seq_bean_free(find_create_seq_bean, env);
+    }
+    
+    if(list)
+    {
+        size = axutil_array_list_size(list, env);
+    }
+    if(list && 0 < size)
+    {
+        int i = 0;
+        sandesha2_create_seq_bean_t *create_seq_bean = NULL;
+       
+        for(i = 0; i < size; i++)
+        {
+            create_seq_bean = (sandesha2_create_seq_bean_t *) axutil_array_list_get(list, env, i);
+            if(create_seq_bean)
+            {
+                sandesha2_create_seq_bean_free(create_seq_bean, env);
+            }
+        }
+    }
+
+    if(list)
+    {
+        axutil_array_list_free(list, env);
+    }
+
+    find_seq_property_bean = sandesha2_seq_property_bean_create_with_data(env, NULL, NULL, seq_id);
+    if(find_seq_property_bean)
+    {
+        list = sandesha2_seq_property_mgr_find(seq_property_mgr, env, find_seq_property_bean);
+        sandesha2_seq_property_bean_free(find_seq_property_bean, env);
+    }
+    
+    if(list)
+    {
+        size = axutil_array_list_size(list, env);
+    }
+    if(list && 0 < size)
+    {
+        int i = 0;
+        sandesha2_seq_property_bean_t *seq_prop_bean = NULL;
+       
+        for(i = 0; i < size; i++)
+        {
+            seq_prop_bean = (sandesha2_seq_property_bean_t *) axutil_array_list_get(list, env, i);
+            if(seq_prop_bean)
+            {
+                axis2_char_t *internal_seq_id = NULL;
+                axis2_char_t *name = NULL;
+
+                name = sandesha2_seq_property_bean_get_name(seq_prop_bean, env);
+                if(!axutil_strcmp(name, SANDESHA2_SEQUENCE_PROPERTY_RMS_INTERNAL_SEQ_ID))
+                {
+                    axutil_array_list_t *temp_list = NULL;
+                    int temp_size = 0;
+                    sandesha2_seq_property_bean_t *temp_find_bean = NULL;
+
+                    internal_seq_id = sandesha2_seq_property_bean_get_value(seq_prop_bean, env);
+
+                    temp_find_bean = sandesha2_seq_property_bean_create_with_data(env, NULL, NULL, internal_seq_id);
+                    if(temp_find_bean)
+                    {
+                        temp_list = sandesha2_seq_property_mgr_find(seq_property_mgr, env, temp_find_bean);
+                        sandesha2_seq_property_bean_free(temp_find_bean, env);
+                    }
+                
+                    if(temp_list)
+                    {
+                        temp_size = axutil_array_list_size(list, env);
+                    }
+                    if(temp_list && 0 < temp_size)
+                    {
+                        int j = 0;
+                        sandesha2_seq_property_bean_t *temp_seq_prop_bean = NULL;
+                   
+                        for(j = 0; j < temp_size; j++)
+                        {
+                            temp_seq_prop_bean = (sandesha2_seq_property_bean_t *) axutil_array_list_get(temp_list, env, i);
+                            if(temp_seq_prop_bean)
+                            {
+                                sandesha2_seq_property_bean_free(temp_seq_prop_bean, env);
+                            }
+                        }
+                    }
+
+                    if(temp_list)
+                    {
+                        axutil_array_list_free(temp_list, env);
+                    }
+                }
+                sandesha2_seq_property_bean_free(seq_prop_bean, env);
+            }
+        }
+    }
+
+    if(list)
+    {
+        axutil_array_list_free(list, env);
+    }
+
+    return AXIS2_SUCCESS;
+}
+
 
 static axis2_bool_t AXIS2_CALL 
 sandesha2_create_seq_msg_processor_offer_accepted(
@@ -415,22 +700,15 @@
     sandesha2_msg_ctx_t *rm_msg_ctx,
     sandesha2_create_seq_mgr_t *create_seq_mgr)
 {
-    sandesha2_create_seq_bean_t *find_bean = NULL;
-    axutil_array_list_t *list = NULL;
-    
     AXIS2_PARAM_CHECK(env->error, seq_id, AXIS2_FALSE);
     AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FALSE);
     AXIS2_PARAM_CHECK(env->error, create_seq_mgr, AXIS2_FALSE);
     
-    find_bean = sandesha2_create_seq_bean_create_with_data(env, NULL, NULL, 
-                        seq_id);
-    list = sandesha2_create_seq_mgr_find(create_seq_mgr, env, find_bean);
     /* Single char offerings are not accepted */
     if(1 >= axutil_strlen(seq_id))
+    {
         return AXIS2_FALSE;
-        
-    if(NULL != list && 0 < axutil_array_list_size(list, env))
-        return AXIS2_FALSE;
+    }
         
     return AXIS2_TRUE;
 }

Modified: webservices/sandesha/trunk/c/src/msgprocessors/create_seq_res_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/create_seq_res_msg_processor.c?rev=690127&r1=690126&r2=690127&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/create_seq_res_msg_processor.c (original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/create_seq_res_msg_processor.c Thu Aug 28 23:56:29 2008
@@ -72,7 +72,6 @@
 #define SANDESHA2_INTF_TO_IMPL(msg_proc) \
 						((sandesha2_create_seq_res_msg_processor_impl_t *)(msg_proc))
 
-/***************************** Function headers *******************************/
 static axis2_status_t AXIS2_CALL 
 sandesha2_create_seq_res_msg_processor_process_in_msg (
     sandesha2_msg_processor_t *msg_processor,
@@ -80,31 +79,16 @@
     sandesha2_msg_ctx_t *rm_msg_ctx);
 
 static axis2_status_t AXIS2_CALL 
-sandesha2_create_seq_res_msg_processor_process_out_msg(
-    sandesha2_msg_processor_t *msg_processor,
-    const axutil_env_t *env, 
-    sandesha2_msg_ctx_t *rm_msg_ctx);
-/*    
-static axis2_bool_t AXIS2_CALL 
-sandesha2_create_seq_res_msg_processor_offer_accepted(
-    const axutil_env_t *env, 
-    axis2_char_t *seq_id,
-    sandesha2_msg_ctx_t *rm_msg_ctx,
-    sandesha2_storage_mgr_t *storage_mgr);
-*/                  
-static axis2_status_t AXIS2_CALL 
 sandesha2_create_seq_res_msg_processor_free (
     sandesha2_msg_processor_t *msg_processor, 
     const axutil_env_t *env);								
 
-/***************************** End of function headers ************************/
 
 AXIS2_EXTERN sandesha2_msg_processor_t* AXIS2_CALL
 sandesha2_create_seq_res_msg_processor_create(
     const axutil_env_t *env)
 {
     sandesha2_create_seq_res_msg_processor_impl_t *msg_proc_impl = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
               
     msg_proc_impl =  (sandesha2_create_seq_res_msg_processor_impl_t *)AXIS2_MALLOC 
                         (env->allocator, 
@@ -121,17 +105,16 @@
     if(!msg_proc_impl->msg_processor.ops)
 	{
 		sandesha2_create_seq_res_msg_processor_free((sandesha2_msg_processor_t*)
-                         msg_proc_impl, env);
+            msg_proc_impl, env);
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
 	}
     
     msg_proc_impl->msg_processor.ops->process_in_msg = 
                         sandesha2_create_seq_res_msg_processor_process_in_msg;
-    msg_proc_impl->msg_processor.ops->process_out_msg = 
-    					sandesha2_create_seq_res_msg_processor_process_out_msg;
-    msg_proc_impl->msg_processor.ops->free = 
-                        sandesha2_create_seq_res_msg_processor_free;
+    msg_proc_impl->msg_processor.ops->process_out_msg = 0;
+
+    msg_proc_impl->msg_processor.ops->free = sandesha2_create_seq_res_msg_processor_free;
                         
 	return &(msg_proc_impl->msg_processor);
 }
@@ -163,157 +146,181 @@
     axis2_msg_ctx_t *msg_ctx = NULL;
     axis2_conf_ctx_t *conf_ctx = NULL;
     sandesha2_storage_mgr_t *storage_mgr = NULL;
-    sandesha2_seq_ack_t *seq_ack = NULL;
     sandesha2_create_seq_res_t *csr_part = NULL;
-    axis2_char_t *new_out_seq_id = NULL;
+    axis2_char_t *rms_sequence_id = NULL;
     axis2_relates_to_t *relates_to = NULL;
     axis2_char_t *create_seq_msg_id = NULL;
     sandesha2_sender_mgr_t *sender_mgr = NULL;
     sandesha2_create_seq_mgr_t *create_seq_mgr = NULL;
     sandesha2_create_seq_bean_t *create_seq_bean = NULL;
-    axis2_char_t *internal_seq_id = NULL;
-    sandesha2_sender_bean_t *create_seq_sender_bean = NULL;
-    axis2_char_t *create_seq_storage_key = NULL;
+    axis2_char_t *internal_sequence_id = NULL;
     sandesha2_seq_property_mgr_t *seq_prop_mgr = NULL;
-    sandesha2_seq_property_bean_t *out_seq_bean = NULL;
-    sandesha2_seq_property_bean_t *int_seq_bean = NULL;
+    sandesha2_seq_property_bean_t *rms_sequence_bean = NULL;
+    sandesha2_seq_property_bean_t *rms_internal_sequence_bean = NULL;
     sandesha2_accept_t *accept = NULL;
     axis2_op_ctx_t *op_ctx = NULL;
     axis2_bool_t polling_mode = AXIS2_FALSE;
     axis2_char_t *dbname = NULL;
     
-    AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE);
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,  
-        "[sandesha2]Entry:sandesha2_create_seq_res_msg_processor_process_in_msg");
+        "[sandesha2] Entry:sandesha2_create_seq_res_msg_processor_process_in_msg");
    
+    AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE);
+
     msg_ctx = sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env);
     conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
     
     dbname = sandesha2_util_get_dbname(env, conf_ctx);
     storage_mgr = sandesha2_utils_get_storage_mgr(env, dbname);
                         
-    seq_ack = sandesha2_msg_ctx_get_seq_ack(rm_msg_ctx, env);
-    if(seq_ack)
-    {
-        sandesha2_msg_processor_t *ack_processor = NULL;
-        ack_processor = sandesha2_ack_msg_processor_create(env);
-        sandesha2_msg_processor_process_in_msg(ack_processor, env, rm_msg_ctx);
-    }
     csr_part = sandesha2_msg_ctx_get_create_seq_res(rm_msg_ctx, env);
     if(!csr_part)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "[sandesha2]Create Sequence Response part is null");
-        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_REQD_MSG_PART_MISSING,
-            AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Create Sequence Response part is null");
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_REQD_MSG_PART_MISSING, AXIS2_FAILURE);
         if(storage_mgr)
+        {
             sandesha2_storage_mgr_free(storage_mgr, env);
+        }
         return AXIS2_FAILURE;
     }
-    new_out_seq_id = sandesha2_identifier_get_identifier(
-                        sandesha2_create_seq_res_get_identifier(csr_part, env),
-                        env);
-    if(!new_out_seq_id)
+
+    rms_sequence_id = sandesha2_identifier_get_identifier(sandesha2_create_seq_res_get_identifier(
+                csr_part, env), env);
+    if(!rms_sequence_id)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "[sandesha2]New sequence id is null");
-        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CANNOT_FIND_SEQ_ID,
-            AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] New sequence id is null");
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CANNOT_FIND_SEQ_ID, AXIS2_FAILURE);
         if(storage_mgr)
+        {
             sandesha2_storage_mgr_free(storage_mgr, env);
+        }
         return AXIS2_FAILURE;
     }
+
     relates_to = axis2_msg_ctx_get_relates_to(msg_ctx, env);
     if(!relates_to)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]Invalid create"\
-            " sequence message. relates_to part is not available");
-        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_INVALID_RELATES_TO,
-            AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+                "[sandesha2] Invalid create sequence message. relates_to part is not available");
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_INVALID_RELATES_TO, AXIS2_FAILURE);
         if(storage_mgr)
+        {
             sandesha2_storage_mgr_free(storage_mgr, env);
+        }
         return AXIS2_FAILURE;
     }
+
     create_seq_msg_id = (axis2_char_t *) axis2_relates_to_get_value(relates_to, env);
     seq_prop_mgr = sandesha2_permanent_seq_property_mgr_create(env, dbname);
     create_seq_mgr = sandesha2_permanent_create_seq_mgr_create(env, dbname);
     sender_mgr = sandesha2_permanent_sender_mgr_create(env, dbname);
-    create_seq_bean = sandesha2_create_seq_mgr_retrieve(create_seq_mgr, env,
-        create_seq_msg_id);
+    create_seq_bean = sandesha2_create_seq_mgr_retrieve(create_seq_mgr, env, create_seq_msg_id);
     if(!create_seq_bean)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "[sandesha2]Create Sequence entry not found");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Create Sequence entry not found");
+
         if(seq_prop_mgr)
+        {
             sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+        }
         if(create_seq_mgr)
+        {
             sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+        }
         if(sender_mgr)
+        {
             sandesha2_sender_mgr_free(sender_mgr, env);
+        }
         if(storage_mgr)
+        {
             sandesha2_storage_mgr_free(storage_mgr, env);
+        }
+
         return AXIS2_FAILURE;
     }
-    internal_seq_id = sandesha2_create_seq_bean_get_internal_seq_id(create_seq_bean,
-        env);
-    if(!internal_seq_id)
+
+    internal_sequence_id = axutil_strdup(env, sandesha2_create_seq_bean_get_internal_sequence_id(
+            create_seq_bean, env));
+
+    if(!internal_sequence_id)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "[sandesha2]Internal sequence id is not set");
-        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CANNOT_FIND_SEQ_ID,
-            AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Internal sequence id is not set");
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CANNOT_FIND_SEQ_ID, AXIS2_FAILURE);
+
+        sandesha2_create_seq_bean_free(create_seq_bean, env);
+
         if(seq_prop_mgr)
+        {
             sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+        }
         if(create_seq_mgr)
+        {
             sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+        }
         if(sender_mgr)
+        {
             sandesha2_sender_mgr_free(sender_mgr, env);
+        }
         if(storage_mgr)
+        {
             sandesha2_storage_mgr_free(storage_mgr, env);
+        }
+
         return AXIS2_FAILURE;
     }
-    sandesha2_create_seq_bean_set_seq_id(create_seq_bean, env, new_out_seq_id);
+
+    sandesha2_create_seq_bean_set_rms_sequence_id(create_seq_bean, env, rms_sequence_id);
     sandesha2_create_seq_mgr_update(create_seq_mgr, env, create_seq_bean);
+    sandesha2_create_seq_bean_free(create_seq_bean, env);
     
-    create_seq_sender_bean = sandesha2_sender_mgr_retrieve(sender_mgr,
-                        env, create_seq_msg_id);
-    if(!create_seq_sender_bean)
+    rms_sequence_bean = sandesha2_seq_property_bean_create_with_data(env, internal_sequence_id,
+                        SANDESHA2_SEQUENCE_PROPERTY_RMS_SEQ_ID, rms_sequence_id);
+    if(rms_sequence_bean)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "[sandesha2]Create sequence entry not found");
-        if(seq_prop_mgr)
-            sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
-        if(create_seq_mgr)
-            sandesha2_create_seq_mgr_free(create_seq_mgr, env);
-        if(sender_mgr)
-            sandesha2_sender_mgr_free(sender_mgr, env);
-        if(storage_mgr)
-            sandesha2_storage_mgr_free(storage_mgr, env);
-        return AXIS2_FAILURE;
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
+                "[sandesha2] Inserting rms_sequence_bean with rms_sequence_id :%s and internal_sequence_id :%s", 
+                rms_sequence_id, internal_sequence_id);
+
+        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, rms_sequence_bean);
+        sandesha2_seq_property_bean_free(rms_sequence_bean, env);
     }
-    create_seq_storage_key = sandesha2_sender_bean_get_msg_ctx_ref_key(
-                        create_seq_sender_bean, env);
-    sandesha2_storage_mgr_remove_msg_ctx(storage_mgr, env, 
-        create_seq_storage_key, conf_ctx, SANDESHA2_MSG_TYPE_CREATE_SEQ);
-    if(create_seq_sender_bean)
-        sandesha2_sender_bean_free(create_seq_sender_bean, env);
-    sandesha2_sender_mgr_remove(sender_mgr, env, create_seq_msg_id);
-    
-    out_seq_bean = sandesha2_seq_property_bean_create_with_data(env, internal_seq_id,
-                        SANDESHA2_SEQ_PROP_OUT_SEQ_ID, new_out_seq_id);
-    
-    int_seq_bean = sandesha2_seq_property_bean_create_with_data(env, 
-                        new_out_seq_id, SANDESHA2_SEQ_PROP_INTERNAL_SEQ_ID,
-                        internal_seq_id);
-    sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, out_seq_bean);
-    sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, int_seq_bean);
+
+    rms_internal_sequence_bean = sandesha2_seq_property_bean_create_with_data(env, rms_sequence_id, 
+            SANDESHA2_SEQUENCE_PROPERTY_RMS_INTERNAL_SEQ_ID, internal_sequence_id);
+    if(rms_internal_sequence_bean)
+    {
+        sandesha2_sender_bean_t *find_sender_bean = NULL;
+        sandesha2_sender_bean_t *sender_bean = NULL;
+
+        find_sender_bean = sandesha2_sender_bean_create(env);
+        sandesha2_sender_bean_set_msg_type(find_sender_bean, env, SANDESHA2_MSG_TYPE_CREATE_SEQ);
+        sandesha2_sender_bean_set_internal_seq_id(find_sender_bean, env, internal_sequence_id);
+        sandesha2_sender_bean_set_send(find_sender_bean, env, AXIS2_TRUE);
+
+        sender_bean = sandesha2_sender_mgr_find_unique(sender_mgr, env, find_sender_bean);
+        if(sender_bean)
+        {
+            axis2_char_t *msg_id = NULL;
+
+            msg_id = sandesha2_sender_bean_get_msg_id(sender_bean, env);
+            sandesha2_sender_mgr_remove(sender_mgr, env, msg_id);
+            sandesha2_sender_bean_free(sender_bean, env);
+        }
+
+        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, rms_internal_sequence_bean);
+        sandesha2_seq_property_bean_free(rms_internal_sequence_bean, env);
+    }
+
     accept = sandesha2_create_seq_res_get_accept(csr_part, env);
+
     if(accept)
     {
         sandesha2_seq_property_bean_t *special_int_seq_bean = NULL;
         sandesha2_seq_property_bean_t *offerd_seq_bean = NULL;
-        axis2_char_t *offered_seq_id = NULL;
+        axis2_char_t *rmd_sequence_id = NULL;
         axis2_endpoint_ref_t *acks_to_epr = NULL;
+        axis2_endpoint_ref_t *to_epr = NULL;
         sandesha2_seq_property_bean_t *acks_to_bean = NULL;
         sandesha2_next_msg_bean_t *next_bean = NULL;
         sandesha2_next_msg_mgr_t *next_msg_mgr = NULL;
@@ -324,200 +331,337 @@
         axis2_char_t *rm_spec_ver = NULL;
         axis2_char_t *addr_ns_val = NULL;
         axis2_char_t *new_msg_store_key = NULL;
+        sandesha2_seq_property_bean_t *to_seq_bean = NULL;
+        sandesha2_msg_ctx_t *create_seq_rm_msg = NULL;
+        axis2_msg_ctx_t *create_seq_msg = NULL;
+        axis2_char_t *acks_to = NULL;
+        axis2_char_t *reply_to_addr = NULL; 
         
         next_msg_mgr = sandesha2_permanent_next_msg_mgr_create(env, dbname);
-        offerd_seq_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env,
-                        internal_seq_id, SANDESHA2_SEQ_PROP_OFFERED_SEQ);
+        offerd_seq_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, internal_sequence_id, 
+                SANDESHA2_SEQ_PROP_OFFERED_SEQ);
+
         if(!offerd_seq_bean)
         {
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-                "[sandesha2]No offered sequence entry. But an accept was received");
+                "[sandesha2] No offered sequence entry. But an accept was received");
+
+            if(internal_sequence_id)
+            {
+                AXIS2_FREE(env->allocator, internal_sequence_id);
+            }
+
             if(seq_prop_mgr)
+            {
                 sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+            }
             if(create_seq_mgr)
+            {
                 sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+            }
             if(sender_mgr)
+            {
                 sandesha2_sender_mgr_free(sender_mgr, env);
+            }
             if(next_msg_mgr)
+            {
                 sandesha2_next_msg_mgr_free(next_msg_mgr, env);
+            }
             if(storage_mgr)
+            {
                 sandesha2_storage_mgr_free(storage_mgr, env);
+            }
+
             return AXIS2_FAILURE;
         }
-        offered_seq_id = sandesha2_seq_property_bean_get_value(offerd_seq_bean,
-                        env);
-        special_int_seq_bean = sandesha2_seq_property_bean_create_with_data(env, 
-            offered_seq_id, SANDESHA2_SEQ_PROP_SPECIAL_INTERNAL_SEQ_ID, internal_seq_id);
+
+        rmd_sequence_id = axutil_strdup(env, sandesha2_seq_property_bean_get_value(offerd_seq_bean, 
+            env));
+
+        sandesha2_seq_property_bean_free(offerd_seq_bean, env);
+
+        special_int_seq_bean = sandesha2_seq_property_bean_create_with_data(env, rmd_sequence_id, 
+                SANDESHA2_SEQ_PROP_SPECIAL_INTERNAL_SEQ_ID, internal_sequence_id);
+
         if(special_int_seq_bean)
         {
-            sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, 
-                special_int_seq_bean);
+            sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, special_int_seq_bean);
             sandesha2_seq_property_bean_free(special_int_seq_bean, env);
         }
+
         acks_to_epr = sandesha2_address_get_epr(sandesha2_acks_to_get_address(
-                        sandesha2_accept_get_acks_to(accept, env), env), env);
+                    sandesha2_accept_get_acks_to(accept, env), env), env);
+
         acks_to_bean = sandesha2_seq_property_bean_create(env);
-        sandesha2_seq_property_bean_set_name(acks_to_bean, env, 
-                        SANDESHA2_SEQ_PROP_ACKS_TO_EPR);
-        sandesha2_seq_property_bean_set_seq_id(acks_to_bean, env, 
-                        offered_seq_id);
-        if (acks_to_epr)
-        {
-            sandesha2_seq_property_bean_set_value(acks_to_bean, env, 
-                        (axis2_char_t*)axis2_endpoint_ref_get_address(
-                        acks_to_epr, env));
+        if(acks_to_bean)
+        {
+            sandesha2_seq_property_bean_set_name(acks_to_bean, env, SANDESHA2_SEQ_PROP_ACKS_TO_EPR);
+            sandesha2_seq_property_bean_set_seq_id(acks_to_bean, env, rmd_sequence_id);
+
+            if (acks_to_epr)
+            {
+                sandesha2_seq_property_bean_set_value(acks_to_bean, env, 
+                    (axis2_char_t*)axis2_endpoint_ref_get_address(acks_to_epr, env));
+            }
+
+            sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, acks_to_bean);
+            sandesha2_seq_property_bean_free(acks_to_bean, env);
         }
-        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, acks_to_bean);
-        
-        next_bean = sandesha2_next_msg_bean_create(env);
-        sandesha2_next_msg_bean_set_seq_id(next_bean, env, offered_seq_id);
-        sandesha2_next_msg_bean_set_internal_seq_id(next_bean, env, internal_seq_id);
-        sandesha2_next_msg_bean_set_next_msg_no_to_process(next_bean, env, 1);
-        
+ 
         rm_spec_ver = sandesha2_msg_ctx_get_rm_spec_ver(rm_msg_ctx, env);
-        if(0 == axutil_strcmp(SANDESHA2_SPEC_VERSION_1_1, rm_spec_ver))
+
+        if(!axutil_strcmp(SANDESHA2_SPEC_VERSION_1_1, rm_spec_ver))
         {
-            axis2_char_t *reply_to_addr = sandesha2_utils_get_seq_property(env, 
-                internal_seq_id, SANDESHA2_SEQ_PROP_REPLY_TO_EPR, seq_prop_mgr); 
+            reply_to_addr = sandesha2_utils_get_seq_property(env, internal_sequence_id, 
+                    SANDESHA2_SEQ_PROP_REPLY_TO_EPR, seq_prop_mgr); 
             if(reply_to_addr)
             {
                 polling_mode = sandesha2_utils_is_anon_uri(env, reply_to_addr);
-                if(reply_to_addr)
-                    AXIS2_FREE(env->allocator, reply_to_addr);
             }
         }
+        
+        acks_to = (axis2_char_t *) axis2_endpoint_ref_get_address(acks_to_epr, env);
+        create_seq_rm_msg = sandesha2_msg_creator_create_create_seq_msg(env, rm_msg_ctx, 
+                internal_sequence_id, acks_to, seq_prop_mgr);
+
+        if(!create_seq_rm_msg)
         {
-            sandesha2_msg_ctx_t *create_seq_rm_msg = NULL;
-            axis2_msg_ctx_t *create_seq_msg = NULL;
-            axis2_char_t *acks_to = NULL;
-            axis2_endpoint_ref_t *to = NULL;
-            sandesha2_seq_property_bean_t *to_seq_bean = NULL;
-            acks_to = (axis2_char_t *) axis2_endpoint_ref_get_address(acks_to_epr, env);
-            create_seq_rm_msg = sandesha2_msg_creator_create_create_seq_msg(env,
-                rm_msg_ctx, internal_seq_id, acks_to, seq_prop_mgr);
-            if(!create_seq_rm_msg)
-            {
-                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-                    "[sandesha2]create_seq_rm_msg is NULL");
-                if(seq_prop_mgr)
-                    sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
-                if(create_seq_mgr)
-                    sandesha2_create_seq_mgr_free(create_seq_mgr, env);
-                if(sender_mgr)
-                    sandesha2_sender_mgr_free(sender_mgr, env);
-                if(next_msg_mgr)
-                    sandesha2_next_msg_mgr_free(next_msg_mgr, env);
-                if(storage_mgr)
-                    sandesha2_storage_mgr_free(storage_mgr, env);
-                if(create_seq_rm_msg)
-                    sandesha2_msg_ctx_free(create_seq_rm_msg, env);
-                return AXIS2_FAILURE;
-
-            }
-            sandesha2_msg_ctx_set_flow(create_seq_rm_msg, env, 
-                SANDESHA2_MSG_CTX_OUT_FLOW);
-            create_seq_msg = sandesha2_msg_ctx_get_msg_ctx(create_seq_rm_msg, env);
-            to_seq_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env,
-                internal_seq_id, SANDESHA2_SEQ_PROP_TO_EPR);
-            if(to_seq_bean)
-            {
-                axis2_char_t *to_addr = sandesha2_seq_property_bean_get_value(
-                    to_seq_bean, env);
-                to = axis2_endpoint_ref_create(env, to_addr); 
-                AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]to:%s", 
-                    to_addr);
-            }
-            else
-            {
-                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-                    "[sandesha2]to_seq_bean is NULL");
-                if(seq_prop_mgr)
-                    sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
-                if(create_seq_mgr)
-                    sandesha2_create_seq_mgr_free(create_seq_mgr, env);
-                if(sender_mgr)
-                    sandesha2_sender_mgr_free(sender_mgr, env);
-                if(next_msg_mgr)
-                    sandesha2_next_msg_mgr_free(next_msg_mgr, env);
-                if(storage_mgr)
-                    sandesha2_storage_mgr_free(storage_mgr, env);
-                if(create_seq_rm_msg)
-                    sandesha2_msg_ctx_free(create_seq_rm_msg, env);
-                return AXIS2_FAILURE;
-            }
-            axis2_msg_ctx_set_to(create_seq_msg, env, to);
-            axis2_msg_ctx_set_relates_to(create_seq_msg, env, NULL);
-            new_msg_store_key = axutil_uuid_gen(env);
-            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-                "[sandesha2]Storing msg_ctx with msg_id:%s", 
-                axis2_msg_ctx_get_msg_id(create_seq_msg, env));
-            sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env, new_msg_store_key, 
-                create_seq_msg);
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]create_seq_rm_msg is NULL");
+
+            if(reply_to_addr)
+            {
+                AXIS2_FREE(env->allocator, reply_to_addr);
+            }
+
+            if(rmd_sequence_id)
+            {
+                AXIS2_FREE(env->allocator, rmd_sequence_id);
+            }
+
+            if(internal_sequence_id)
+            {
+                AXIS2_FREE(env->allocator, internal_sequence_id);
+            }
+
+            if(seq_prop_mgr)
+            {
+                sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+            }
+            if(create_seq_mgr)
+            {
+                sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+            }
+            if(sender_mgr)
+            {
+                sandesha2_sender_mgr_free(sender_mgr, env);
+            }
+            if(next_msg_mgr)
+            {
+                sandesha2_next_msg_mgr_free(next_msg_mgr, env);
+            }
+            if(storage_mgr)
+            {
+                sandesha2_storage_mgr_free(storage_mgr, env);
+            }
+
+            return AXIS2_FAILURE;
+        }
+
+        sandesha2_msg_ctx_set_flow(create_seq_rm_msg, env, SANDESHA2_MSG_CTX_OUT_FLOW);
+        create_seq_msg = sandesha2_msg_ctx_get_msg_ctx(create_seq_rm_msg, env);
+        to_seq_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, internal_sequence_id, 
+                SANDESHA2_SEQ_PROP_TO_EPR);
+
+        if(to_seq_bean)
+        {
+            axis2_char_t *to_addr = sandesha2_seq_property_bean_get_value(to_seq_bean, env);
+            to_epr = axis2_endpoint_ref_create(env, to_addr);
+
+            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]to:%s", to_addr);
+            sandesha2_seq_property_bean_free(to_seq_bean, env);
+        }
+        else
+        {
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] to_seq_bean is NULL");
+
+            if(reply_to_addr)
+            {
+                AXIS2_FREE(env->allocator, reply_to_addr);
+            }
+
+            if(rmd_sequence_id)
+            {
+                AXIS2_FREE(env->allocator, rmd_sequence_id);
+            }
+
+            if(internal_sequence_id)
+            {
+                AXIS2_FREE(env->allocator, internal_sequence_id);
+            }
+
+            if(seq_prop_mgr)
+            {
+                sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+            }
+            if(create_seq_mgr)
+            {
+                sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+            }
+            if(sender_mgr)
+            {
+                sandesha2_sender_mgr_free(sender_mgr, env);
+            }
+            if(next_msg_mgr)
+            {
+                sandesha2_next_msg_mgr_free(next_msg_mgr, env);
+            }
+            if(storage_mgr)
+            {
+                sandesha2_storage_mgr_free(storage_mgr, env);
+            }
+        
+            if(create_seq_msg)
+            {
+                axis2_msg_ctx_free(create_seq_msg, env);
+            }
+
             if(create_seq_rm_msg)
+            {
                 sandesha2_msg_ctx_free(create_seq_rm_msg, env);
+            }
+
+            return AXIS2_FAILURE;
         }
-        sandesha2_next_msg_bean_set_ref_msg_key(next_bean, env, 
-            new_msg_store_key);
+
+        axis2_msg_ctx_set_to(create_seq_msg, env, to_epr);
+        axis2_msg_ctx_set_relates_to(create_seq_msg, env, NULL);
+        new_msg_store_key = axutil_uuid_gen(env);
+
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]Storing msg_ctx with msg_id:%s", 
+                axis2_msg_ctx_get_msg_id(create_seq_msg, env));
+
+        sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env, new_msg_store_key, create_seq_msg, 
+                AXIS2_TRUE);
+
+        next_bean = sandesha2_next_msg_bean_create(env);
+        sandesha2_next_msg_bean_set_seq_id(next_bean, env, rmd_sequence_id);
+        sandesha2_next_msg_bean_set_internal_seq_id(next_bean, env, internal_sequence_id);
+        sandesha2_next_msg_bean_set_next_msg_no_to_process(next_bean, env, 1);
+        sandesha2_next_msg_bean_set_ref_msg_key(next_bean, env, new_msg_store_key);
         sandesha2_next_msg_bean_set_polling_mode(next_bean, env, polling_mode);
+        if(new_msg_store_key)
+        {
+            AXIS2_FREE(env->allocator, new_msg_store_key);
+        }
+
         /* If polling_mode is true, starting the polling manager */
         if(polling_mode)
         {
-            sandesha2_utils_start_polling_mgr(env, conf_ctx, internal_seq_id);
+            sandesha2_polling_mgr_start(env, conf_ctx, storage_mgr, sender_mgr, create_seq_rm_msg, 
+                    internal_sequence_id, rmd_sequence_id, reply_to_addr);
         }
+
         sandesha2_next_msg_mgr_insert(next_msg_mgr, env, next_bean);
+        sandesha2_next_msg_bean_free(next_bean, env);
         
-        spec_ver_bean = sandesha2_seq_property_bean_create_with_data(env, 
-            offered_seq_id, SANDESHA2_SEQ_PROP_RM_SPEC_VERSION, rm_spec_ver);
-        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, spec_ver_bean);
+        spec_ver_bean = sandesha2_seq_property_bean_create_with_data(env, rmd_sequence_id, 
+                SANDESHA2_SEQ_PROP_RM_SPEC_VERSION, rm_spec_ver);
+
+        if(spec_ver_bean)
+        {
+            sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, spec_ver_bean);
+            sandesha2_seq_property_bean_free(spec_ver_bean, env);
+        }
         
-        rcvd_msg_bean = sandesha2_seq_property_bean_create_with_data(env, 
-                        offered_seq_id, 
-                        SANDESHA2_SEQ_PROP_SERVER_COMPLETED_MESSAGES, "");
-        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, rcvd_msg_bean);
+        rcvd_msg_bean = sandesha2_seq_property_bean_create_with_data(env, rmd_sequence_id, 
+                SANDESHA2_SEQ_PROP_SERVER_COMPLETED_MESSAGES, "");
+
+        if(rcvd_msg_bean)
+        {
+            sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, rcvd_msg_bean);
+            sandesha2_seq_property_bean_free(rcvd_msg_bean, env);
+        }
         
-        msgs_bean = sandesha2_seq_property_bean_create_with_data(env,
-                        offered_seq_id, 
-                        SANDESHA2_SEQ_PROP_CLIENT_COMPLETED_MESSAGES, "");
-        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, msgs_bean);
+        msgs_bean = sandesha2_seq_property_bean_create_with_data(env, rmd_sequence_id, 
+                SANDESHA2_SEQ_PROP_CLIENT_COMPLETED_MESSAGES, "");
+        if(msgs_bean)
+        {
+            sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, msgs_bean);
+            sandesha2_seq_property_bean_free(msgs_bean, env);
+        }
         
         addr_ns_val = sandesha2_msg_ctx_get_addr_ns_val(rm_msg_ctx, env);
-        addr_ver_bean = sandesha2_seq_property_bean_create_with_data(env, 
-                        offered_seq_id, 
-                        SANDESHA2_SEQ_PROP_ADDRESSING_NAMESPACE_VALUE,
-                        addr_ns_val);
-        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, addr_ver_bean);
+        addr_ver_bean = sandesha2_seq_property_bean_create_with_data(env, rmd_sequence_id, 
+                SANDESHA2_SEQ_PROP_ADDRESSING_NAMESPACE_VALUE, addr_ns_val);
+        if(addr_ver_bean)
+        {
+            sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, addr_ver_bean);
+            sandesha2_seq_property_bean_free(addr_ver_bean, env);
+        }
+
+        if(create_seq_msg)
+        {
+            axis2_core_utils_reset_out_msg_ctx(env, create_seq_msg);
+            axis2_msg_ctx_free(create_seq_msg, env);
+        }
+
+        if(reply_to_addr)
+        {
+            AXIS2_FREE(env->allocator, reply_to_addr);
+        }
+
+        if(create_seq_rm_msg)
+        {
+            sandesha2_msg_ctx_free(create_seq_rm_msg, env);
+        }
+
         if(next_msg_mgr)
+        {
             sandesha2_next_msg_mgr_free(next_msg_mgr, env);
-    }
-    sandesha2_seq_mgr_update_last_activated_time(env, internal_seq_id, seq_prop_mgr);
+        }
+
+        if(rmd_sequence_id)
+        {
+            AXIS2_FREE(env->allocator, rmd_sequence_id);
+        }
+    } /* End of if accept block */
+
+    sandesha2_seq_mgr_update_last_activated_time(env, internal_sequence_id, seq_prop_mgr);
     op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
     axis2_op_ctx_set_response_written(op_ctx, env, AXIS2_TRUE);
+    
+    /* Pausing the flow here so that it won't go to a message receiver which is not set for this flow */
     sandesha2_msg_ctx_set_paused(rm_msg_ctx, env, AXIS2_TRUE);
+
+    if(internal_sequence_id)
+    {
+        AXIS2_FREE(env->allocator, internal_sequence_id);
+    }
+
     if(seq_prop_mgr)
+    {
         sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+    }
+
     if(create_seq_mgr)
+    {
         sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+    }
+
     if(sender_mgr)
+    {
         sandesha2_sender_mgr_free(sender_mgr, env);
+    }
+
     if(storage_mgr)
+    {
         sandesha2_storage_mgr_free(storage_mgr, env);
+    }
+
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,  
         "[sandesha2]Exit:sandesha2_create_seq_res_msg_processor_process_in_msg");
+
     return AXIS2_SUCCESS;
     
 }
     
-static axis2_status_t AXIS2_CALL 
-sandesha2_create_seq_res_msg_processor_process_out_msg(
-    sandesha2_msg_processor_t *msg_processor,
-    const axutil_env_t *env, 
-    sandesha2_msg_ctx_t *rm_msg_ctx)
-{
-    AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE);
-    
-    /* TODO
-     * adding the SANDESHA_LISTENER
-     */
-    return AXIS2_SUCCESS;
-}
-

Modified: webservices/sandesha/trunk/c/src/msgprocessors/make_connection_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/make_connection_msg_processor.c?rev=690127&r1=690126&r2=690127&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/make_connection_msg_processor.c (original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/make_connection_msg_processor.c Thu Aug 28 23:56:29 2008
@@ -229,7 +229,7 @@
     sandesha2_create_seq_mgr_t *create_seq_mgr = NULL;
     sandesha2_sender_bean_t *sender_bean = NULL;
     sandesha2_sender_bean_t *bean1 = NULL;
-    sandesha2_address_t *address = NULL;
+    sandesha2_mc_address_t *address = NULL;
     sandesha2_identifier_t *identifier = NULL;
     sandesha2_msg_ctx_t *return_rm_msg_ctx = NULL;
     axutil_property_t *property = NULL;
@@ -251,6 +251,8 @@
     sandesha2_seq_property_bean_t *int_seq_bean = NULL;
     axutil_array_list_t *msgs_not_to_send = NULL;
     axis2_char_t *dbname = NULL;
+    /*const axis2_char_t *wsa_action = NULL;
+    axutil_string_t *soap_action = NULL;*/
 
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,  
         "[sandesha2]Entry:sandesha2_make_connection_msg_processor_process_in_msg");
@@ -271,7 +273,11 @@
         seq_id = sandesha2_identifier_get_identifier(identifier, env);
     msg_ctx = sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env);
     if(msg_ctx)
+    {
         conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
+        axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_TRUE);
+    }
+
     if(conf_ctx)
         dbname = sandesha2_util_get_dbname(env, conf_ctx);
     storage_mgr = sandesha2_utils_get_storage_mgr(env, dbname);
@@ -282,7 +288,7 @@
         sender_mgr = sandesha2_permanent_sender_mgr_create(env, dbname);
     }
     int_seq_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, 
-        seq_id, SANDESHA2_SEQ_PROP_INTERNAL_SEQ_ID);
+        seq_id, SANDESHA2_SEQUENCE_PROPERTY_RMS_INTERNAL_SEQ_ID);
     if(int_seq_bean)
         internal_seq_id = sandesha2_seq_property_bean_get_value(int_seq_bean, env);
 
@@ -321,6 +327,7 @@
     }
     msg_storage_key = sandesha2_sender_bean_get_msg_ctx_ref_key(sender_bean, 
         env);
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "dam_msg_storage_key:%s", msg_storage_key);
     return_msg_ctx = sandesha2_storage_mgr_retrieve_msg_ctx(storage_mgr, env, 
         msg_storage_key, conf_ctx, AXIS2_TRUE);
     if(!return_msg_ctx)
@@ -337,6 +344,15 @@
             sandesha2_storage_mgr_free(storage_mgr, env);
         return AXIS2_FAILURE;
     }
+
+    /*wsa_action = axis2_msg_ctx_get_wsa_action(return_msg_ctx, env);
+    soap_action = axutil_string_create(env, wsa_action);
+    if(soap_action)
+    {
+        axis2_msg_ctx_set_soap_action(return_msg_ctx, env, soap_action);
+        axutil_string_free(soap_action, env);
+    }*/
+
     return_rm_msg_ctx = sandesha2_msg_init_init_msg(env, return_msg_ctx);
     add_msg_pending_header(env, return_rm_msg_ctx, pending);
     set_transport_properties(env, return_msg_ctx, rm_msg_ctx);
@@ -500,14 +516,13 @@
                 env), env);
         conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
         int_seq_id = sandesha2_utils_get_seq_property(env, seq_id, 
-            SANDESHA2_SEQ_PROP_INTERNAL_SEQ_ID, seq_prop_mgr);
+            SANDESHA2_SEQUENCE_PROPERTY_RMS_INTERNAL_SEQ_ID, seq_prop_mgr);
         sandesha2_terminate_mgr_terminate_sending_side(env, conf_ctx,
             int_seq_id, axis2_msg_ctx_get_server_side(msg_ctx, env), 
                 storage_mgr, seq_prop_mgr, create_seq_mgr, sender_mgr);
         if(int_seq_id)
             AXIS2_FREE(env->allocator, int_seq_id);
     }
-    axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_TRUE);
     if(seq_prop_mgr)
         sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
     if(create_seq_mgr)
@@ -577,7 +592,7 @@
     axis2_char_t *dbname)
 {
     int i = 0;
-    int index = 0;
+    int index = -1;
     int match_list_size = 0;
     axutil_array_list_t *match_list = NULL;
     axis2_char_t sql_find[1024];
@@ -622,6 +637,21 @@
         msg_type = sandesha2_sender_bean_get_msg_type(bean, env);
         AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]msg_type:%d", 
             msg_type);
+
+        if(msg_type == SANDESHA2_MSG_TYPE_ACK)
+        {
+            /* For the time being we do not send acknowledgement messages in the make connection 
+             * back channel 
+             */
+            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] ack msg type is still not supported");
+            continue;
+        }
+        
+        if(msg_type == SANDESHA2_MSG_TYPE_MAKE_CONNECTION_MSG)
+        {
+            continue;
+        }
+
         if(msg_type == SANDESHA2_MSG_TYPE_APPLICATION)
         {
             long msg_no = sandesha2_sender_bean_get_msg_no(bean, env);



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org


Mime
View raw message