1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- using Apache.NMS;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.SymbolStore;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace EasyMQ
- {
- internal struct TypeHandle
- {
- public RuntimeTypeHandle First;
- public RuntimeTypeHandle Second;
- public override bool Equals(object? obj)
- {
- if (obj is TypeHandle handle)
- {
- return handle.First.Value == First.Value && handle.Second.Value == Second.Value;
- }
- else return false;
- }
- public static bool operator == (TypeHandle handle1,TypeHandle handle2)
- {
- return (handle1.Second.Value == handle2.Second.Value) && (handle2.First.Value == handle1.First.Value);
- }
- public static bool operator !=(TypeHandle handle1, TypeHandle handle2)
- {
- return (handle1.Second.Value != handle2.Second.Value) || (handle2.First.Value != handle1.First.Value);
- }
- public override int GetHashCode()
- {
- return First.GetHashCode() | Second.GetHashCode();
- }
- public static TypeHandle GetHandle<TFirst,TSecond>()
- {
- return new TypeHandle()
- {
- First = typeof(TFirst).TypeHandle,
- Second = typeof(TSecond).TypeHandle
- };
- }
- }
- internal sealed class MQHandle
- {
- public MQHandle(IMessageProducer producer, IMessageConsumer consumer)
- {
- Producer = producer;
- Consumer = consumer;
- }
- public Apache.NMS.IMessageProducer Producer { get; }
- public Apache.NMS.IMessageConsumer Consumer { get; }
- }
- }
|