[PATCH 2/2] [MAMADOTNET] Add getName() to MamaTransport


Gary Molloy <g.molloy@...>
 

Testing Strategy

--------------------

 

Modify the MamaPublisherCS.cs example application and add the following after you have created your publisher:

 

            publisher.create(transport, outboundTopic);

 

            MamaTransport aTransport = new MamaTransport();

            aTransport = publisher.getTransport();

            string tportName = aTransport.getName();

            Console.WriteLine("TEST:: getTransport name {0}.", tportName);

 

You can expect to see the following output:

 

> MamaPublisher.exe -m wmw -tport tcp_sub

Created inbound subscription.
TEST:: getTransport name tcp_sub. <--------------------------- test output
Publishing message to MAMA_TOPIC.
Publishing message to MAMA_TOPIC.
Publishing message to MAMA_TOPIC.
Publishing message to MAMA_TOPIC.

 

 

======================================================================================================================

 

From 3abc196ba5a09beecbe000463c015c086c86fbea Mon Sep 17 00:00:00 2001

From: Gary Molloy <g.molloy@...>

Date: Mon, 18 May 2015 13:55:43 +0100

Subject: [PATCH 2/2] [MAMADOTNET] Add getName() to MamaTransport

 

Function already exists for C / C++ / JNI

 

Signed-off-by: Gary Molloy <g.molloy@...>

---

mama/dotnet/src/cs/MamaTransport.cs | 15 +++++++++++++++

1 file changed, 15 insertions(+)

 

diff --git a/mama/dotnet/src/cs/MamaTransport.cs b/mama/dotnet/src/cs/MamaTransport.cs

index fee71cb..11a8f71 100644

--- a/mama/dotnet/src/cs/MamaTransport.cs

+++ b/mama/dotnet/src/cs/MamaTransport.cs

@@ -260,6 +260,18 @@ namespace Wombat

                                  GC.KeepAlive(callback);

       }        

 

+      /// <summary>

+      /// Get the name of the transport.

+      /// </summary>

+      public string getName()

+      {

+                             // Get the transport name from the native layer

+                               IntPtr ret = IntPtr.Zero;

+                               CheckResultCode(NativeMethods.mamaTransport_getName(nativeHandle, ref ret));

+

+                               // Convert to an ANSI string

+                               return Marshal.PtrToStringAnsi(ret);

+      }

 

                               #region Implementation details

 

@@ -430,6 +442,9 @@ namespace Wombat

             [DllImport(Mama.DllName, CallingConvention = CallingConvention.Cdecl)]

             public static extern int mamaTransport_getQuality(IntPtr transport,

                                                               ref MamaQuality qual);

+            [DllImport(Mama.DllName, CallingConvention = CallingConvention.Cdecl)]

+            public static extern int mamaTransport_getName(IntPtr transport,

+                                                           ref IntPtr ret);

                                }

 

                               // state

--

2.1.0

 

 

 

Gary Molloy – SR Labs

Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD

g.molloy@...

 

Join Openmama-dev@lists.openmama.org to automatically receive all group messages.