You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sandesha-dev@ws.apache.org by da...@apache.org on 2008/10/10 09:40:56 UTC
svn commit: r703342 - in /webservices/sandesha/trunk/c/src/msgprocessors:
app_msg_processor.c terminate_seq_msg_processor.c
Author: damitha
Date: Fri Oct 10 00:40:56 2008
New Revision: 703342
URL: http://svn.apache.org/viewvc?rev=703342&view=rev
Log:
Adding code comments
Modified:
webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c
webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_msg_processor.c
Modified: webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c?rev=703342&r1=703341&r2=703342&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c (original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c Fri Oct 10 00:40:56 2008
@@ -592,12 +592,14 @@
highest_in_msg_no = msg_no;
msg_id = axis2_msg_ctx_get_msg_id(app_msg_ctx, env);
+ /* Store the highest in message number received so far */
highest_msg_no_bean = sandesha2_seq_property_bean_create_with_data(env, rmd_sequence_id,
SANDESHA2_SEQ_PROP_HIGHEST_IN_MSG_NUMBER, msg_num_str);
highest_msg_key_bean = sandesha2_seq_property_bean_create_with_data(env, rmd_sequence_id,
SANDESHA2_SEQ_PROP_HIGHEST_IN_MSG_KEY, highest_in_msg_key_str);
+ /* Store the id of the highest in message number message */
highest_msg_id_bean = sandesha2_seq_property_bean_create_with_data(env, rmd_sequence_id,
SANDESHA2_SEQ_PROP_HIGHEST_IN_MSG_ID, (axis2_char_t *)msg_id);
@@ -753,7 +755,8 @@
sandesha2_seq_property_bean_t *seq_prop_bean = NULL;
AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Last message");
-
+
+ /* Store the id of the last RM 1.0 message */
seq_prop_bean = sandesha2_seq_property_bean_create_with_data(
env, rmd_sequence_id, SANDESHA2_SEQ_PROP_LAST_IN_MESSAGE_ID, msg_id);
if(seq_prop_bean)
@@ -1106,7 +1109,7 @@
req_seq = sandesha2_msg_ctx_get_sequence(req_rm_msg_ctx, env);
if(!req_seq)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]Sequence is NULL");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Sequence is NULL");
AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SEQ_NOT_EXIST, AXIS2_FAILURE);
if(req_rm_msg_ctx)
{
@@ -1163,33 +1166,11 @@
request_msg_no = sandesha2_msg_number_get_msg_num(sandesha2_seq_get_msg_num(req_seq, env), env);
internal_sequence_id = sandesha2_utils_get_internal_sequence_id(env, rmd_sequence_id);
-
- /* Deciding whether this is the last message. We assume it is if it
- * relates to a message which arrived with the LastMessage flag on it.
- */
- /*last_req_id = sandesha2_utils_get_seq_property(env, rmd_sequence_id,
- SANDESHA2_SEQ_PROP_LAST_IN_MESSAGE_ID, seq_prop_mgr);
-
- relates_to = axis2_msg_ctx_get_relates_to(msg_ctx, env);
- relates_to_value = (axis2_char_t *)axis2_relates_to_get_value(relates_to, env);
- if(relates_to && last_req_id && !axutil_strcmp(last_req_id, relates_to_value))
- {
- last_msg = AXIS2_TRUE;
- }
-
- if(last_req_id)
- {
- AXIS2_FREE(env->allocator, last_req_id);
- }*/
-
- /*last_msg = sandesha2_app_msg_processor_is_last_out_msg(env, msg_ctx, rmd_sequence_id,
- internal_sequence_id, seq_prop_mgr);*/
}
else /* Client side */
{
axis2_char_t *to = NULL;
axis2_char_t *seq_key = NULL;
- /*axis2_char_t *last_app_msg = NULL;*/
to = (axis2_char_t*)axis2_endpoint_ref_get_address(to_epr, env);
property = axis2_msg_ctx_get_property(msg_ctx, env, SANDESHA2_CLIENT_SEQ_KEY);
@@ -1207,37 +1188,6 @@
internal_sequence_id = sandesha2_utils_get_client_internal_sequence_id(env, to,
seq_key);
-
- /*last_msg = sandesha2_app_msg_processor_is_last_out_msg(env, msg_ctx, NULL,
- internal_sequence_id, seq_prop_mgr);*/
-
- /*property = axis2_msg_ctx_get_property(msg_ctx, env, SANDESHA2_CLIENT_LAST_MESSAGE);
- if(property)
- {
- last_app_msg = axutil_property_get_value(property, env);
- }
-
- if(last_app_msg && !axutil_strcmp(last_app_msg, AXIS2_VALUE_TRUE))
- {
- spec_ver = sandesha2_utils_get_rm_version(env, internal_sequence_id, seq_prop_mgr);
- if(!spec_ver)
- {
- axutil_property_t *spec_ver_prop = NULL;
- spec_ver_prop = axis2_msg_ctx_get_property(msg_ctx, env,
- SANDESHA2_CLIENT_RM_SPEC_VERSION);
-
- spec_ver = axutil_strdup(env, axutil_property_get_value(spec_ver_prop, env));
- }
- if(sandesha2_spec_specific_consts_is_last_msg_indicator_reqd(env, spec_ver))
- {
- last_msg = AXIS2_TRUE;
- }
- if(spec_ver)
- {
- AXIS2_FREE(env->allocator, spec_ver);
- spec_ver = NULL;
- }
- }*/
}
seq_timeout_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, internal_sequence_id,
@@ -2786,6 +2736,9 @@
return status;
}
+/*
+ * First
+ */
static axis2_status_t AXIS2_CALL
sandesha2_app_msg_processor_send_app_msg(
const axutil_env_t *env,
@@ -3045,6 +2998,10 @@
SANDESHA2_SEQ_PROP_ACKS_TO_EPR);
}
+ /* Decide if this is the RM 1.0 last message. If it is, store the message number which can be used
+ * in ack message processor and terminate sequence message processor to know if the RM1.0 last msg
+ * has arrived.
+ */
sandesha2_app_msg_processor_is_last_out_msg(env, app_msg_ctx, rmd_sequence_id,
internal_sequence_id, msg_num, seq_prop_mgr);
@@ -4117,7 +4074,7 @@
axis2_char_t *relates_to_value = NULL;
const axis2_relates_to_t *relates_to = NULL;
- /* Deciding whether this is the last message. We assume it is if it
+ /* Deciding whether this is the last message. We assume it is, if it
* relates to a message which arrived with the LastMessage flag on it.
*/
last_req_id = sandesha2_utils_get_seq_property(env, rmd_sequence_id,
@@ -4178,7 +4135,8 @@
sandesha2_seq_property_bean_t *res_last_msg_key_bean = NULL;
AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Last message true");
- sprintf(msg_number_str, "%ld", msg_num);
+ sprintf(msg_number_str, "%ld", msg_num);
+ /* Store the message number of the RM 1.0 last message */
res_last_msg_key_bean = sandesha2_seq_property_bean_create_with_data(env,
internal_sequence_id, SANDESHA2_SEQ_PROP_LAST_OUT_MESSAGE_NO, msg_number_str);
Modified: webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_msg_processor.c?rev=703342&r1=703341&r2=703342&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_msg_processor.c (original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_msg_processor.c Fri Oct 10 00:40:56 2008
@@ -283,6 +283,9 @@
}
seq_ack = sandesha2_msg_ctx_get_seq_ack(rm_msg_ctx, env);
+ /* If we have received a sequence acknowldegment with the incoming terminate message then we may
+ * decide to send the terminate sequence message.
+ */
if(seq_ack)
{
axis2_char_t *internal_sequence_id = NULL;
@@ -316,6 +319,7 @@
}
else
{
+ /* Retrieve the message number of the RM 1.0 last message */
last_out_msg_no_str = sandesha2_utils_get_seq_property(env, internal_sequence_id,
SANDESHA2_SEQ_PROP_LAST_OUT_MESSAGE_NO, seq_prop_mgr);
@@ -338,7 +342,8 @@
axis2_bool_t completed = AXIS2_FALSE;
axutil_array_list_t *ack_range_list = NULL;
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "highest_out_msg_no:%ld", highest_out_msg_no);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] highest_out_msg_no:%ld",
+ highest_out_msg_no);
ack_range_list = sandesha2_seq_ack_get_ack_range_list(seq_ack, env);
completed = sandesha2_ack_mgr_verify_seq_completion(env, ack_range_list,
@@ -347,7 +352,7 @@
if(completed)
{
AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
- "[sandesha2]Sequence %s is completed. So adding terminate msg",
+ "[sandesha2] Sequence %s is completed. So adding terminate msg",
rms_sequence_id);
sandesha2_terminate_mgr_send_terminate_seq_msg(env, rm_msg_ctx, rms_sequence_id,
@@ -376,6 +381,8 @@
sandesha2_seq_mgr_update_last_activated_time(env, rmd_sequence_id, storage_mgr);
*/
+ /* We have no intention to pass this message beyond Sandesha2/C handler. So pause the message
+ * context */
sandesha2_msg_ctx_set_paused(rm_msg_ctx, env, AXIS2_TRUE);
if(seq_prop_mgr)
@@ -409,7 +416,12 @@
return AXIS2_SUCCESS;
}
-
+/*
+ * Since we have received the terminate sequence message we determine the last in message which
+ * arrived prior to this terminate message. Then we mark it as the last message. We also determine if
+ * an out message is already sent related to that highest in comming message. If so then we determine
+ * whether we have received ack messages for them. If so send the terminate sequence message.
+ */
static axis2_status_t AXIS2_CALL
sandesha2_terminate_seq_msg_processor_setup_highest_msg_nums(
const axutil_env_t *env,
@@ -438,14 +450,16 @@
AXIS2_PARAM_CHECK(env->error, sender_mgr, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, seq_id, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE);
-
+
+ /* Message number of the highest in comming message so far */
highest_in_msg_num_str = sandesha2_utils_get_seq_property(env, seq_id,
SANDESHA2_SEQ_PROP_HIGHEST_IN_MSG_NUMBER, seq_prop_mgr);
+ /* Message id of the highest in comming message so far */
highest_in_msg_id = sandesha2_utils_get_seq_property(env, seq_id,
SANDESHA2_SEQ_PROP_HIGHEST_IN_MSG_ID, seq_prop_mgr);
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]highest_in_msg_num_str:%s",
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Highest_in_msg_num_str:%s",
highest_in_msg_num_str);
if(highest_in_msg_num_str)
@@ -481,7 +495,9 @@
else
{
/* Mark up the highest inbound message as if it had the last message
- * flag on it.*/
+ * flag on it. We can do this because we have received the terminate sequence message. So
+ * we can treat the highest in-comming message as the last message.
+ */
sandesha2_seq_property_bean_t *last_in_msg_bean = NULL;
axis2_char_t *highest_out_relates_to = NULL;
@@ -494,8 +510,8 @@
sandesha2_seq_property_bean_free(last_in_msg_bean, env);
}
- /* If an outbound message has already gone out with that relatesTo, then
- * we can terminate right away.
+ /* If an outbound message has already gone out witch relates to the highest in message id,
+ * then we can terminate right away.
*/
highest_out_relates_to = sandesha2_utils_get_seq_property(env, rec_side_int_seq_id,
SANDESHA2_SEQ_PROP_HIGHEST_OUT_RELATES_TO, seq_prop_mgr);
@@ -526,12 +542,12 @@
AXIS2_FREE(env->allocator, highest_in_msg_id);
}
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]add_rec_side_term:%d", add_rec_side_term);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] add_rec_side_term:%d", add_rec_side_term);
out_seq_id = sandesha2_utils_get_seq_property(env, rec_side_int_seq_id,
SANDESHA2_SEQUENCE_PROPERTY_RMS_SEQ_ID, seq_prop_mgr);
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]out_seq_id:%s", out_seq_id);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] out_seq_id:%s", out_seq_id);
if(rec_side_int_seq_id)
{
AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] rec_side_int_seq_id:%s", rec_side_int_seq_id);
@@ -567,7 +583,7 @@
}
AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Exit:sandesha2_terminate_seq_msg_processor_setup_highest_msg_nums");
+ "[sandesha2] Exit:sandesha2_terminate_seq_msg_processor_setup_highest_msg_nums");
return AXIS2_SUCCESS;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org