本文整理汇总了C#中IMessage类的典型用法代码示例。如果您正苦于以下问题:C# IMessage类的具体用法?C# IMessage怎么用?C# IMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMessage类属于命名空间,在下文中一共展示了IMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
protected override void Process(IMessage input, Action<IMessage> continueWith, Action<FlowRuntimeException> unhandledException)
{
if (input is ActivationMessage)
_continueWith = continueWith;
else
_translator.Process_local_output(input);
}
示例2: TS
///<summary>
/// Creates a TS.
/// <param name="message">The Message to which this Type belongs</param>
/// <param name="description">The description of this type</param>
///</summary>
public TS(IMessage message, string description)
: base(message, description)
{
data = new IType[2];
data[0] = new TSComponentOne(message,"Time of an event");
data[1] = new ST(message,"Degree of precision");
}
示例3: ToAmqpMessage
// NMS Message AMQP Message
// ================================ =================
// string NMSCorrelationID string CorrelationId
// MsgDeliveryMode NMSDeliveryMode bool Durable
// IDestination NMSDestination
// string MNSMessageId string MessageId
// MsgPriority NMSPriority byte Priority
// bool NMSRedelivered bool Redelivered
// IDestination NMSReplyTo Address ReplyTo
// DateTime NMSTimestamp
// TimeSpan NMSTimeToLive Duration Ttl
// string NMSType string ContentType
// IPrimitiveMap Properties Dictionary Properties
// string Subject
// string UserId
//
public virtual Message ToAmqpMessage(IMessage message)
{
Message amqpMessage = CreateAmqpMessage(message);
if (null != message.NMSCorrelationID)
{
amqpMessage.CorrelationId = message.NMSCorrelationID;
}
amqpMessage.Durable = (message.NMSDeliveryMode == MsgDeliveryMode.Persistent);
if (null != message.NMSMessageId)
{
amqpMessage.MessageId = message.NMSMessageId;
}
amqpMessage.Priority = ToAmqpMessagePriority(message.NMSPriority);
amqpMessage.Redelivered = message.NMSRedelivered;
if (null != message.NMSReplyTo)
{
amqpMessage.ReplyTo = ToAmqpAddress(message.NMSReplyTo);
}
if (message.NMSTimeToLive != TimeSpan.Zero)
{
amqpMessage.Ttl = ToQpidDuration(message.NMSTimeToLive);
}
if (null != message.NMSType)
{
amqpMessage.ContentType = message.NMSType;
}
amqpMessage.Properties = FromNmsPrimitiveMap(message.Properties);
// TODO: NMSDestination, Amqp.Subect, Amqp.UserId
return amqpMessage;
}
示例4: Invoke
public override IMessage Invoke(IMessage msg)
{
var mcm = msg as IMethodCallMessage;
if (mcm == null)
return null;
if (IsEqualsCall(mcm))
return ReturnValue(HandleEquals(mcm), mcm);
if (IsGetHashCodeCall(mcm))
return ReturnValue(GetHashCode(), mcm);
if (IsGetTypeCall(mcm))
return ReturnValue(GetProxiedType(), mcm);
if (IsToStringCall(mcm))
{
var type = GetProxiedType();
var hashCode = GetHashCode();
var value = string.Format("RemotingMock_{0}<{1}>", hashCode, type.Name);
return ReturnValue(value, mcm);
}
var invocation = new RemotingInvocation(this, mcm);
interceptor.Intercept(invocation);
return ReturnValue(invocation.ReturnValue, invocation.Arguments, mcm);
}
示例5: HandleRequestMessage
protected override void HandleRequestMessage(IMessage message, ReplyMessageHolder replyHolder)
{
object result = SplitMessage(message);
if(result == null) {
return;
}
object correlationId = message.Headers.Id;
if(result is ICollection) {
ICollection items = (ICollection)result;
int sequenceNumber = 0;
int sequenceCount = items.Count;
foreach(object item in items) {
AddReply(replyHolder, item, correlationId, ++sequenceNumber, sequenceCount);
}
}
else if(result.GetType().IsArray) {
object[] items = (object[])result;
int sequenceNumber = 0;
int sequenceSize = items.Length;
foreach(object item in items) {
AddReply(replyHolder, item, correlationId, ++sequenceNumber, sequenceSize);
}
}
else {
AddReply(replyHolder, result, correlationId, 1, 1);
}
}
示例6: PTA
///<summary>
/// Creates a PTA.
/// <param name="message">The Message to which this Type belongs</param>
/// <param name="description">The description of this type</param>
///</summary>
public PTA(IMessage message, string description) : base(message, description){
data = new IType[4];
data[0] = new IS(message, 147,"Policy Type");
data[1] = new IS(message, 193,"Amount Class");
data[2] = new NM(message,"Money or Percentage Quantity");
data[3] = new MOP(message,"Money or Percentage");
}
示例7: GetResponseStream
public Stream GetResponseStream (IServerResponseChannelSinkStack sinkStack,
object state,
IMessage msg,
ITransportHeaders headers)
{
return null;
}
示例8: GetRequestStream
public Stream GetRequestStream(IMessage requestMsg, ITransportHeaders requestHeaders)
{
// parameters validation
if (requestHeaders == null)
throw new ArgumentNullException("requestHeaders");
IMethodCallMessage methodCall = requestMsg as IMethodCallMessage;
if (methodCall == null)
throw new NotSupportedException();
if (_connection != null)
{
// close connection as it is probably not valid
_connection.Close();
}
// get connection from the cache
_connection = _connectionCache.GetConnection(_channelUri);
try
{
// return stream for writing request
return _connection.GetRequestStream(methodCall, requestHeaders);
}
catch
{
// close connection as it is probably not valid
_connection.Close();
_connection = null;
throw;
}
}
示例9: For
public static ErrorReply For(IMessage message)
{
return new ErrorReply
{
ReplyFor = message.Id
};
}
示例10:
void IMutateOutgoingTransportMessages.MutateOutgoing(IMessage[] messages, TransportMessage transportMessage)
{
if (transportMessage.Headers.ContainsKey(WindowsIdentityName))
transportMessage.Headers.Remove(WindowsIdentityName);
transportMessage.Headers.Add(WindowsIdentityName, Thread.CurrentPrincipal.Identity.Name);
}
示例11: DispatchReplyMessage
public void DispatchReplyMessage(IMessage msg)
{
if (this._replySink != null)
{
this._replySink.SyncProcessMessage(msg);
}
}
示例12: GetResponseStream
public Stream GetResponseStream (IServerResponseChannelSinkStack sinkStack,
object state,
IMessage msg,
ITransportHeaders headers)
{
throw new NotImplementedException();
}
示例13: Post
public Result Post(IMessage message)
{
try
{
var request = WebRequest.Create(message.Url) as HttpWebRequest;
request.Method = "POST";
foreach (string key in message.Headers.Keys)
{
var value = message.Headers[key];
if (key == "content-type")
{
request.ContentType = value;
continue;
}
request.Headers.Add(key, value);
}
request.Headers.Add("submitted", this.TimeProvider.GetEpochInMilliSeconds(DateTimeKind.Utc).ToString(CultureInfo.InvariantCulture));
return this.RequestAndRespond(request, message.Body);
}
catch (Exception)
{
return Result.PermanentError;
}
}
示例14: UiMessage
public UiMessage(IMessage message, Contact contact)
{
Address = message.Address;
Text = message.Text;
TimeStamp = message.TimeStamp;
Contact = contact;
}
示例15: QSC
///<summary>
/// Creates a QSC.
/// <param name="message">The Message to which this Type belongs</param>
/// <param name="description">The description of this type</param>
///</summary>
public QSC(IMessage message, string description) : base(message, description){
data = new IType[4];
data[0] = new ST(message,"Name of field");
data[1] = new ID(message, 0,"Relational operator");
data[2] = new ST(message,"Value");
data[3] = new ID(message, 0,"Relational conjunction");
}