Example #1
0
// ////////////////////////////////////////////////////////////////////////////
bool ReplyInfoRv::DoRecvImpl(TibrvMsg &recv_data, int wait_ms,
	bool throw_on_time_out_flag) const
{
	Check();

	if (callback_ptr_->done_flag_)
		throw RvException("Attempt to receive a single-shot reply failed "
			"because the callback instance indicates the reply has already "
			"been received.");

	double      time_out  = (wait_ms < 0) ? -1.0 :
		(static_cast<double>(wait_ms) / 1000.0);

	TibrvStatus rv_status = queue_ptr_->timedDispatch(time_out);

	if (callback_ptr_->done_flag_) {
		if (callback_ptr_->success_flag_) {
			RvUtilX_THROW_TIBRV_STATUS_IF(callback_ptr_->msg_recv_.createCopy,
				(recv_data));
			return(true);
		}
		throw RvException(callback_ptr_->error_text_);
	}
	else if (rv_status == TIBRV_TIMEOUT) {
		if (throw_on_time_out_flag)
			throw RvExceptionTimeOut(time_out, "Attempt to receive a single-"
				"shot reply failed");
	}
	else if (rv_status != TIBRV_OK)
		throw RvExceptionStatus(rv_status, "Attempt to receive a single-shot "
			"reply failed");

	return(false);
}
Example #2
0
// ////////////////////////////////////////////////////////////////////////////
void ReplyInfoRv::Check() const
{
	if (rv_context_ptr_ == NULL)
		throw RvException("The ReplyInfoRv 'rv_context_ptr_' member is 'NULL'.");
	else if (transport_ptr_ == NULL)
		throw RvException("The ReplyInfoRv 'transport_ptr_' member is 'NULL'.");
	else if (queue_ptr_ == NULL)
		throw RvException("The ReplyInfoRv 'queue_ptr_' member is 'NULL'.");
	else if (listener_ptr_ == NULL)
		throw RvException("The ReplyInfoRv 'listener_ptr_' member is 'NULL'.");
	else if (callback_ptr_ == NULL)
		throw RvException("The ReplyInfoRv 'callback_ptr_' member is 'NULL'.");
}
Example #3
0
// ////////////////////////////////////////////////////////////////////////////
void SubjectNameFlat::CheckFullNameSubjectName(const char *subject_name)
{
	if (!IsFullNameSubjectName(subject_name)) {
		std::ostringstream error_text;
		error_text << "Subject name '" << subject_name <<
			"' is not a fully-qualified subject name.";
		//	CODE NOTE: Should throw RvBadSubjectException
		throw RvException(error_text);
	}
}
Example #4
0
// ////////////////////////////////////////////////////////////////////////////
void SubjectNameFlat::CheckPatternSubjectName(const char *subject_name)
{
	if (!IsPatternSubjectName(subject_name)) {
		std::ostringstream error_text;
		error_text << "Subject name '" << subject_name <<
			"' is not an explicit Rendezvous subject name pattern.";
		//	CODE NOTE: Should throw RvBadSubjectException
		throw RvException(error_text);
	}
}
Example #5
0
//	////////////////////////////////////////////////////////////////////////////
TibrvNetTransport *GetTransport(const TibrvFtMember &ft_member)
{
	TibrvTransport *out_transport = ft_member.getTransport();

	if (out_transport == NULL)
		throw RvException("Invocation of 'TibrvFtMember::getTransport()' "
			"failed because the method returned 'NULL' --- the transport has "
			"probably not been created.");

	//	Only TibrvNetTransports can be used in the create function...
	return(static_cast<TibrvNetTransport *>(out_transport));
}
Example #6
0
// ////////////////////////////////////////////////////////////////////////////
void SubjectNameFlat::CheckReplyName()
{
	try {
		CheckFullName();
		if (!IsReplyName()) {
			//	CODE NOTE: Should throw RvBadSubjectException
			std::string subject_name(ToString());
			throw RvException("The length of subject name '" + subject_name +
				"' (" + MLB::Utility::AnyToString(subject_name.size()) +
				") exceeds the maximum permissible (" +
				MLB::Utility::AnyToString(MaxReplySubjectSize) + ").");
		}
	}
	catch (const std::exception &except) {
		MLB::Utility::Rethrow(except, "Not a valid Tib/Rendezvous reply "
			"subject: " + std::string(except.what()));
	}
}