Re: C# DQPublisher Manager
Mathias Kim
Hi Frank,
Testing the broker feature took us a while since building Qpid isn’t as straightforward on Windows as it seems on Linux. As you suggested when using the broker the slowdown after client disconnect disappears. However, the broker seems to be very slow.
We were testing it with the same C# classes that showed acceptable performance without the broker. Using the broker, every received message adds a delay of roughly two seconds at the client app. The publisher app is not affected and works as fast as before. This only occurs if we simulate a very busy symbol. Symbols with fewer updates are not affected. Also, Qpid only uses one core whereas the publisher/client setup without broker uses all 4 available cores evenly.
How is the performance on Linux?
We’re using - Windows 8 - Broker, publisher and client on the same machine - Qpid 0.32 & Proton 0.7
Also, we noticed a very strange thing: this whole thing only works if we enable all logging(-t). Without, no communication happens.
Regards
Mathias |
||||
|
||||
Tick42 bidge for TREP
Tom Doust
Hi,
Many of you will be aware that Tick42 have been developing an OpenMAMA bridge for Thomson Reuters TREP. You may also have noticed that it was publicly announced yesterday.
There is a press release at http://www.finextra.com/news/announcement.aspx?pressreleaseid=60079 and details of how to get it at http://tick42.com/trepbridge
The Tick42 Bridge provides support for subscribing to L1 and L2 data (full book or aggregated by price) and published amam messages as either an interactive or non-interactive provider. It supports contribution by posting rssl messages. It includes flexible mapping between TR and mama/mamda fieldnames, field ids and types. In addition to the open source release we have an enhanced version that is available under licence from Tick42 that includes source discovery, the ability to accept posted messages, handling legacy MFEED messages, and, in the next release, the ability to handle ANSI page data.
Please note that you will need a licenced UPA SDK from Thomson Reuters in order to build and run the code and obviously a TREP infrastructure to connect to.
Please feel free to contact us either directly or through the OpenMAMA mailing lists if you have questions or comments.
Best Regards
Tom Doust
|
||||
|
||||
Re: Bloomberg and OpenMAMA
Sanjeev Wahi <wahi@...>
Hi Nestor, I did something similar (Making a Proto-Type of arca-order-book/algo-trading & QuantLib www.quantlib.org ) for a retail client in the past (using MAMDA/Wombat when it was owned by NYSE). (I did not use Tick42, so I cannot speak for Tick42 but with Wombat it works like following)
I developed few generic-utility templates using C/C++ OpenMAMA/OpenMAMDA API.
The data-flow works like following:
For details refer page # 22 of the attached OpenMAMDA doc.
Hope that helps,
-Best Regards, Sanjeev
From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Macrux
A link to the image, if you can't see it: image
On 11 June 2015 at 11:48, Macrux <kmacrux@...> wrote:
|
||||
|
||||
Re: Bloomberg and OpenMAMA
Macrux <kmacrux@...>
A link to the image, if you can't see it: image On 11 June 2015 at 11:48, Macrux <kmacrux@...> wrote:
|
||||
|
||||
Re: Bloomberg and OpenMAMA
Macrux <kmacrux@...>
Hi Gary, Tom, Now, thinking about the Tom answer, right now it seems not to be possible to get the order book using the tick42 bridge, do you know how could I accomplish this requirement?I'm going to clarify the scenario: I'm trying to build an Automatic Trading System on the OpenMAMA basis. The initial market data provider is Bloomberg (a normal subscription, not b-pipe). I want to run different algorithms where each one is a separated instance, like the figure shows: Do you have any suggestion about a better way to build this algorithmic trading system? Thanks in advance and, Kind regards, On 10 June 2015 at 11:21, Tom Doust <tom.doust@...> wrote:
|
||||
|
||||
Re: Bloomberg and OpenMAMA
Tom Doust
Hi Nestor
Just to add to Gary’s reply. The Bloomberg API will support multiple connections on the same source. The number of different symbols you can subscribe to is limited only by what you are entitled to and by any subscription limits that Bloomberg may apply to your account.
Currently, the Tick42 blp bridge does not generate mamda book messages. This is planned for a future version, but not yet scheduled
I hope this answers you questions, but please feel free to contact us if you need any further information.
Best regards
Tom Doust
From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...]
On Behalf Of Gary Molloy
Sent: 08 June 2015 15:37 To: Macrux; openmama-dev@... Subject: Re: [Openmama-dev] Bloomberg and OpenMAMA
Hi Nestor,
Thanks for your email.
Could I ask you to clarify your scenario a bit more please? For example when you say you have multiple subscribing applications, would these be separate instances of the application, or perhaps with the same process? From an OpenMAMA perspective there shouldn’t be any problem with making multiple subscriptions to the same source via the same bridge.
For your second query, yes OpenMAMDA is capable handling orderbooks.
Thanks, Gary
Gary Molloy – SR Labs Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD
From:
openmama-dev-bounces@... [mailto:openmama-dev-bounces@...]
On Behalf Of Macrux
Hi there, I have some doubts about OpenMAMA and Bloomberg. In first place, I'm wondering if it is possible to conect multiple subscriber applications to bloomberg (using the tick42blp middleware bridge), each one subscribed to the same source (the
name space for the data, e.g. "BlpMktData"), but subscribed to a different symbols, something like this: | subscriber-1 | | subscriber-2 | | subscriber-n |
| openMAMA | |________________________________________| | bloomberg bridge | *subscriber-1, 2 and n are subscribed to diferent individual symbols. In second place, is it possible to use openMAMDA to get the order books for each one of those subscribed symbols with the current available bridge from Tick42? And that's all. Thank you for your help, I will really appreciate it, and other additional information or advices you want to give me. Best regards, Nestor.
|
||||
|
||||
Re: Bloomberg and OpenMAMA
Gary Molloy <g.molloy@...>
Hi Nestor,
Thanks for your email.
Could I ask you to clarify your scenario a bit more please? For example when you say you have multiple subscribing applications, would these be separate instances of the application, or perhaps with the same process? From an OpenMAMA perspective there shouldn’t be any problem with making multiple subscriptions to the same source via the same bridge.
For your second query, yes OpenMAMDA is capable handling orderbooks.
Thanks, Gary
Gary Molloy – SR Labs Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD
From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...]
On Behalf Of Macrux
Sent: 28 May 2015 18:34 To: openmama-dev@... Subject: [Openmama-dev] Bloomberg and OpenMAMA
Hi there, I have some doubts about OpenMAMA and Bloomberg. In first place, I'm wondering if it is possible to conect multiple subscriber applications to bloomberg (using the tick42blp middleware bridge), each one subscribed to the same source (the
name space for the data, e.g. "BlpMktData"), but subscribed to a different symbols, something like this: | subscriber-1 | | subscriber-2 | | subscriber-n |
| openMAMA | |________________________________________| | bloomberg bridge | *subscriber-1, 2 and n are subscribed to diferent individual symbols. In second place, is it possible to use openMAMDA to get the order books for each one of those subscribed symbols with the current available bridge from Tick42? And that's all. Thank you for your help, I will really appreciate it, and other additional information or advices you want to give me. Best regards, Nestor.
|
||||
|
||||
Re: C# DQPublisher Manager
Frank Quinn <fquinn.ni@...>
Oh - and with the broker implementation, you no longer require a separate transport for pub and sub unless they're on different subnets - you just point both sides to the broker. Cheers, Frank On Fri, Jun 5, 2015 at 1:32 PM, Frank Quinn <fquinn.ni@...> wrote:
|
||||
|
||||
Re: C# DQPublisher Manager
Frank Quinn <fquinn.ni@...>
Hi Mathias, The best documentation for this was probably on the original commit note: It contains an example transport - all you need to to is change your IPs to the IP address of qpidd (running as described) and then just run your MAMA example applications using -m qpid -tport qpidbroker. Note it contains a new mama.qpid.transport.<transportname>.type parameter to let the bridge know that this is a broker transport. Cheers, Frank On Fri, Jun 5, 2015 at 1:20 PM, Mathias Kim <Mathias.Kim@...> wrote:
|
||||
|
||||
Re: C# DQPublisher Manager
Mathias Kim
Hi Frank,
thanks for looking into this. We’re now having a look into the qpid bridge with broker. We compiled the bridge but then got stuck using it. Can you provide documentation on how to use the broker feature with the examples, e.g. capturereplayc?
Regards
Mathias
From: Frank Quinn [mailto:fquinn.ni@...]
Sent: Freitag, 5. Juni 2015 00:39 To: Mathias Kim Cc: openmama-dev@... Subject: Re: [Openmama-dev] C# DQPublisher Manager
Hi Mathias,
Tracking this via http://bugs.openmama.org/show_bug.cgi?id=41 – looks like the proton folks added something in 0.8 to allow you to pull out link information from a messenger which we may be able to take advantage of. It looks like it’ll involve a little expansion of the endpoint code to store more information about an endpoint than just its URI but it should be doable.
Cheers, Frank
On Mon, Jun 1, 2015 at 7:03 PM, Frank Quinn <fquinn.ni@...> wrote:
|
||||
|
||||
Re: C# DQPublisher Manager
Frank Quinn <fquinn.ni@...>
Hi Mathias,
Tracking this via http://bugs.openmama.org/show_bug.cgi?id=41 – looks like the proton folks added something in 0.8 to allow you to pull out link information from a messenger which we may be able to take advantage of. It looks like it’ll involve a little expansion of the endpoint code to store more information about an endpoint than just its URI but it should be doable.
Cheers, Frank On Mon, Jun 1, 2015 at 7:03 PM, Frank Quinn <fquinn.ni@...> wrote:
|
||||
|
||||
Re: C# DQPublisher Manager
Frank Quinn <fquinn.ni@...>
Hi Mathias, I just tried a scenario similar to what you described with mamapublisherc and mamasubscriberc and I can confirm that I can see the same issue. I'll have a look at what Qpid Proton have to offer in their latest releases to handle this scenario but I remember looking at this before and the problem revolves around the fact that most of the time, our calls to pn_messenger_put and pn_messenger_send don't actually return any error codes in the event of failure. If you look in the code, you'll see that we actually do error checking on those function calls but they don't return any failure.In fact I just checked and we raised this with the proton guys 2 years ago and they never responded so maybe we should chase that up :) http://qpid.2158936.n2.nabble.com/Detecting-and-capturing-underlying-problems-and-event-with-pn-messenger-td7595635.html To answer your more specific questions: - This is 100% qpid proton / MAMA - not your application's fault - The bridge doesn't even know, so we can't tell the application until we get a good answer from the qpid proton folks or find some new mechanism that has been added to handle this - This is certainly the case with MAMA but the underlying middleware implementation may not be so flippant as is the case here - all connections in AMQP implementations are connection oriented so they will always be a little more interactive by nature On a side note, have you tried our test Qpid Proton Broker implementation http://git.openmama.org/?p=OpenMAMA.git;a=shortlog;h=refs/heads/feature-qpid-broker ? I expect it will make a lot of these sorts of problems go away and it will be a lot easier to configure (you don't need to specify a different port for each client, for example). Note that to use that branch, both clients and publishers will need to be compiled against it as the bridge's protocol messages have changed in that version. On Mon, Jun 1, 2015 at 4:00 PM, Mathias Kim <Mathias.Kim@...> wrote: Hi guys, |
||||
|
||||
Re: C# DQPublisher Manager
Mathias Kim
Hi guys,
toggle quoted message
Show quoted text
we managed to implement the dqpublishermanager and the dqpublisher in C# and most things seem to work well. Setting up a server app with the qpid bridge works, as well as sending dummy market data to a client. Also, multiple clients can subscribe to the server and all get the messages reasonably fast. Nevertheless, one huge issue remains: Whenever one client disconnects, the server continues to send that symbol to that client. So far, this behavior was expected. Unfortunately, as soon as the client destroys its transport, sending takes a lot longer than before. Also, we get an error which depends on the qpid version (SASL header mismatch with v0.8, connection aborted with v0.7). This slows down the whole server until the client connects again. Then the server sends all the messages which it tried so send during the client's off time. As soon this is done, the server is reacting normal and works as before. We now ask ourselves: - Is this problem caused by our implementation of the dqpublisher/manager or is this rather a qpid issue? - Is there any way for the server to get notified when a client disconnects/doesn't respond anymore? - We initially thought that openmama/qpid just sends out (broadcasts) messages and doesn't care whether they arrive or not. Is this the case? Regards Mathias -----Original Message-----
From: Ian Bell [mailto:ian.bell@...] Sent: Dienstag, 14. April 2015 13:49 To: Mathias Kim Cc: openmama-dev@... Subject: RE: [Openmama-dev] C# DQPublisher Manager Hi Just wondering if you go this sorted? The first request should route through to the OnNewRequst callback. As a guess I suspect that the topic is 100% correct, or possibly the callback delegates are not hooked up completely. Can you supply the code and some logs and I may be able to spot the issue. Thanks, Ian Bell Hapsoft Consulting Ltd 138 Belmont Road, Belfast, BT4 2AQ Office: +447481866051 Web: www.hapsoftconsulting.co.uk -----Original Message----- From: Mathias Kim [mailto:Mathias.Kim@...] Sent: 25 March 2015 16:40 Subject: [Openmama-dev] C# DQPublisher Manager Hi guys, we continued wrapping the dqpublishermanager class in C# but got stuck again. We can create a dqpublishermanager and I also get the onCreate callback. Now, we try to notify the dqpm that there is interest in a certain symbol. We try to connect to the dqpm via a qpid bridge. Unfortunately, the request never arrives at the dqpm so the OnNewRequest callback never gets called. However, the transport class recognizes the request and notifies us on the console. It even remembers that we previously shows interest in the same symbol. Therefore we like to know whether our implementation is faulty or whether we need to route the request from the transport to the dqpm ourselves. How does this generally work? Hope you can help us. Best regards Mathias Kim ETF Analyst Phone +49 89 442327-191 Mobile +49 171 4152665 mathias.kim at crossflow.de<mailto:mathias.kim at crossflow.de> www.crossflow.de<https://exchange.assenagon.com/owa/redir.aspx?C=tVJgRBMA7UG6CkQ3TBnr2S2utVWiDdIIBlqZxpqCNcW6tUTfy7PQJ8R4pX_VH_LEFJ8GJHinPD8.&URL=http%3a%2f%2fwww.crossflow.de> Crossflow Financial Advisors GmbH Sonnenstra?e 19 D-80331 M?nchen Local Court of Munich HRB 186408 Managing Directors: Markus Deffner, Juergen Fritzen, Erol Steiner The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this e-mail may be unlawful. If you have received this e-mail in error, please notify the sender immediately and delete it from your system. E-mail transmission cannot be guaranteed to be secure or error free, as messages can be intercepted, corrupted, contain viruses, arrive late or incomplete. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.openmama.org/pipermail/openmama-dev/attachments/20150325/6a1d3525/attachment.html> |
||||
|
||||
Bloomberg and OpenMAMA
Macrux <kmacrux@...>
Hi there, I have some doubts about OpenMAMA and Bloomberg. In first place, I'm wondering if it is possible to conect multiple subscriber applications to bloomberg (using the tick42blp middleware bridge), each one subscribed to the same source (the name space for the data, e.g. "BlpMktData"), but subscribed to a different symbols, something like this:___________ ___________ ___________ |___________| |___________| |___________| _______|____________|_____________|_______ |________________________________________| _______|________ | bloomberg bridge | |________________| *subscriber-1, 2 and n are subscribed to diferent individual symbols. In second place, is it possible to use openMAMDA to get the order books for each one of those subscribed symbols with the current available bridge from Tick42? And that's all. Thank you for your help, I will really appreciate it, and other additional information or advices you want to give me. Best regards, Nestor. |
||||
|
||||
Re: OpenMAMA-2.3.3-rc1
Adrienne Ambrose <a.ambrose@...>
Hi Reed,
Thanks for the feedback, it is greatly appreciated. Please keep us informed on the outcome of any further testing.
Thanks, Adrienne
From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...]
On Behalf Of Alpert, Reed
Sent: 27 May 2015 15:29 To: Gary Molloy; openmama-dev@... Subject: Re: [Openmama-dev] OpenMAMA-2.3.3-rc1
We’ve been testing with this release and have no issues so far. Testing C++ and Java clients. Publish and subscribe. Solace and Tick42 bridges.
Reed Alpert | Corporate & Investment Bank | Market Data Services | J.P. Morgan | 4 Metrotech Center, 23rd Floor, Brooklyn, NY 11245 | T: 718.242.5198 | M: 917.414.4613 | reed.alpert@... Alternate Contact: CIB PIM Trading Technology Solutions NA | CIB_PIM_Trading_Technology_Solutions_NA@...
From:
openmama-dev-bounces@... [mailto:openmama-dev-bounces@...]
On Behalf Of Gary Molloy
Hi Guys,
I have cut the new OpenMAMA-2.3.3 branch and created the OpenMAMA-2.3.3-rc1 tag, this is now available for testing. I would anticipate a test period of around 2-3 weeks with a view to making the release official by the end of the month.
This release has been cut from the next branch.
The following list of issues/features have been added for this release:
BZ-166 Wombat: wInterlocked_set inconsistent return value BZ-164 MAMAJNI: MamaPublisher: Overloaded MamaPublisher create method BZ-169 Wombat queue has no separate deallocate method BZ-176 Missing actions for snapshot subscriptions transition to deactivate state BZ-168 Complete support for Vector Bool and Vector Char field types BZ-156 No value expansion of last property line in mama.properties BZ-178 Problem with mamaDictionary_getDictionaryMessage when multiple bridges are loaded BZ-182 MAMAJAVA: Add java MamaDateTime::getAsFormattedString() method BZ-181 MAMAJAVA: Java subscription setup fix - it loses the closure BZ-183 SCons: OpenMAMA will not build on windows BZ-189 [MAMAC] mamaPlugin Feature BZ-190 [MAMAC] Add ability to turn on/off entitlements on a per bridge basis BZ-191 [MAMAC] mamaPublisherImpl_getTransportImpl() accessor BZ-179 OpenMAMA mock RPM's fail to build BZ-187 SCons: Include stdout for build commands using site scons logger BZ-188 Scons: fixes for Windows and Linux BZ-192 OpenMAMA RPM Release Scripts
Thanks, Gary
Gary Molloy – SR Labs Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD
This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates (collectively, "JPMC"). This transmission may contain information that is proprietary, privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Although this transmission and any attachments are believed to be free of any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMC for any loss or damage arising in any way from its use. Please note that any electronic communication that is conducted within or through JPMC's systems is subject to interception, monitoring, review, retention and external production in accordance with JPMC's policy and local laws, rules and regulations; may be stored or otherwise processed in countries other than the country in which you are located; and will be treated in accordance with JPMC policies and applicable laws and regulations. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities. |
||||
|
||||
Re: OpenMAMA-2.3.3-rc1
Alpert, Reed <reed.alpert@...>
We’ve been testing with this release and have no issues so far. Testing C++ and Java clients. Publish and subscribe. Solace and Tick42 bridges.
Reed Alpert | Corporate & Investment Bank | Market Data Services | J.P. Morgan | 4 Metrotech Center, 23rd Floor, Brooklyn, NY 11245 | T: 718.242.5198 | M: 917.414.4613 | reed.alpert@... Alternate Contact: CIB PIM Trading Technology Solutions NA | CIB_PIM_Trading_Technology_Solutions_NA@...
From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...]
On Behalf Of Gary Molloy
Sent: Tuesday, May 05, 2015 10:31 AM To: openmama-dev@... Subject: [Openmama-dev] OpenMAMA-2.3.3-rc1
Hi Guys,
I have cut the new OpenMAMA-2.3.3 branch and created the OpenMAMA-2.3.3-rc1 tag, this is now available for testing. I would anticipate a test period of around 2-3 weeks with a view to making the release official by the end of the month.
This release has been cut from the next branch.
The following list of issues/features have been added for this release:
BZ-166 Wombat: wInterlocked_set inconsistent return value BZ-164 MAMAJNI: MamaPublisher: Overloaded MamaPublisher create method BZ-169 Wombat queue has no separate deallocate method BZ-176 Missing actions for snapshot subscriptions transition to deactivate state BZ-168 Complete support for Vector Bool and Vector Char field types BZ-156 No value expansion of last property line in mama.properties BZ-178 Problem with mamaDictionary_getDictionaryMessage when multiple bridges are loaded BZ-182 MAMAJAVA: Add java MamaDateTime::getAsFormattedString() method BZ-181 MAMAJAVA: Java subscription setup fix - it loses the closure BZ-183 SCons: OpenMAMA will not build on windows BZ-189 [MAMAC] mamaPlugin Feature BZ-190 [MAMAC] Add ability to turn on/off entitlements on a per bridge basis BZ-191 [MAMAC] mamaPublisherImpl_getTransportImpl() accessor BZ-179 OpenMAMA mock RPM's fail to build BZ-187 SCons: Include stdout for build commands using site scons logger BZ-188 Scons: fixes for Windows and Linux BZ-192 OpenMAMA RPM Release Scripts
Thanks, Gary
Gary Molloy – SR Labs Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD
This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates (collectively, "JPMC"). This transmission may contain information that is proprietary, privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Although this transmission and any attachments are believed to be free of any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMC for any loss or damage arising in any way from its use. Please note that any electronic communication that is conducted within or through JPMC's systems is subject to interception, monitoring, review, retention and external production in accordance with JPMC's policy and local laws, rules and regulations; may be stored or otherwise processed in countries other than the country in which you are located; and will be treated in accordance with JPMC policies and applicable laws and regulations. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities. |
||||
|
||||
[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.
======================================================================================================================
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
|
||||
|
||||
[PATCH 1/2] [MAMA ALL] New accessor mamaPublisher_getTransport()
Gary Molloy <g.molloy@...>
Testing Strategy --------------------
Modify the relevant mamaPublisher example applications to add the following (after you have created the publisher):
C
mamaTransport aTransport = NULL; status = mamaPublisher_getTransport (gPublisher, &aTransport); if (MAMA_STATUS_OK == status) { const char* tportName = NULL; mamaTransport_getName (aTransport, &tportName); printf ("TEST: getTransport: %s\n", tportName); }
CPP
MamaTransport* aTransport = NULL;
aTransport = new MamaTransport (); aTransport = publisher.getTransport (); const char* tportName; tportName = aTransport ->getName (); printf ("TEST: getTransport: %s\n", tportName);
JNI
MamaTransport aTransport = new MamaTransport(); aTransport = myPublisher.getTransport(); String tportName = aTransport.getName(); System.out.println( "TEST: getTransport: " + tportName + "\n");
C#
MamaTransport aTransport = new MamaTransport(); aTransport = publisher.getTransport(); string tportName = aTransport.getName(); Console.WriteLine("TEST: getTransport: {0}", tportName);
From each you can expected the following output, for example:
$ mamapublisherc -m wmw -tport tcp_sub … Created inbound subscription. TEST: getTransport: tcp_sub Publishing message to MAMA_TOPIC. …
There is also an update to the unittests. Running UnitTestMamaC you can expect to see the following:
... ... [----------] 2 tests from MamaPublisherTestC [ RUN ] MamaPublisherTestC.CreateDestroy [ OK ] MamaPublisherTestC.CreateDestroy (16 ms) [ RUN ] MamaPublisherTestC.GetTransport <-------------- new unittest [ OK ] MamaPublisherTestC.GetTransport (16 ms) [----------] 2 tests from MamaPublisherTestC (32 ms total) ... ...
======================================================================================================================
From dbb860193ac5fd07c7116eb479fc41360b12b6cd Mon Sep 17 00:00:00 2001 From: Gary Molloy <g.molloy@...> Date: Thu, 21 May 2015 17:27:10 +0100 Subject: [PATCH 1/2] [MAMA ALL] New accessor mamaPublisher_getTransport()
Replace the existing mamaPublisherImpl_getTransportImpl() function and add for all languages
Signed-off-by: Gary Molloy <g.molloy@...> --- mama/c_cpp/src/c/mama/publisher.h | 15 +++++++ mama/c_cpp/src/c/publisher.c | 12 ++++-- mama/c_cpp/src/c/publisherimpl.h | 3 -- mama/c_cpp/src/cpp/MamaPublisher.cpp | 10 ++++- mama/c_cpp/src/cpp/mama/MamaPublisher.h | 8 +++- mama/c_cpp/src/gunittest/c/publishertest.cpp | 33 ++++++++++++++++ mama/dotnet/src/cs/MamaPublisher.cs | 32 ++++++++++++++- mama/jni/src/c/mamapublisherjni.c | 52 ++++++++++++++++++++++++- mama/jni/src/com/wombat/mama/MamaPublisher.java | 28 +++++++++++++ mama/jni/src/com/wombat/mama/MamaTransport.java | 5 +++ 10 files changed, 185 insertions(+), 13 deletions(-)
diff --git a/mama/c_cpp/src/c/mama/publisher.h b/mama/c_cpp/src/c/mama/publisher.h index bb192c6..a4bbde1 100644 --- a/mama/c_cpp/src/c/mama/publisher.h +++ b/mama/c_cpp/src/c/mama/publisher.h @@ -181,6 +181,21 @@ MAMAExpDLL extern mama_status mamaPublisher_destroy (mamaPublisher publisher); +/** + * @brief Return the <code>mamaTransport</code> for this publisher. + * + * @param[in] publisher The mamaPublisher from which to retrieve the transport for. + * @param[out] transport A pointer to hold the transport. + * + * @return mama_status return code can be one of: + * MAMA_STATUS_NULL_ARG + * MAMA_STATUS_OK + */ +MAMAExpDLL +extern mama_status +mamaPublisher_getTransport (mamaPublisher publisher, + mamaTransport* transport); + #if defined( __cplusplus ) } #endif /* defined( __cplusplus ) */ diff --git a/mama/c_cpp/src/c/publisher.c b/mama/c_cpp/src/c/publisher.c index 2efd88d..89e4f5d 100644 --- a/mama/c_cpp/src/c/publisher.c +++ b/mama/c_cpp/src/c/publisher.c @@ -600,11 +600,15 @@ mama_status mamaPublisherImpl_clearTransport (mamaPublisher publisher) return mamaPublisherImpl_destroy((mamaPublisherImpl *)publisher); } -mamaTransport -mamaPublisherImpl_getTransportImpl (mamaPublisher publisher) +mama_status +mamaPublisher_getTransport (mamaPublisher publisher, + mamaTransport* transport) { mamaPublisherImpl* impl = (mamaPublisherImpl*)publisher; - if (!impl) return NULL; - return impl->mTport; + if (!impl) return MAMA_STATUS_NULL_ARG; + *transport = impl->mTport; + + return MAMA_STATUS_OK; } + diff --git a/mama/c_cpp/src/c/publisherimpl.h b/mama/c_cpp/src/c/publisherimpl.h index b9b9c43..f336fd8 100644 --- a/mama/c_cpp/src/c/publisherimpl.h +++ b/mama/c_cpp/src/c/publisherimpl.h @@ -44,9 +44,6 @@ mamaPublisher_sendFromInboxByIndex (mamaPublisher publisher, mama_status mamaPublisherImpl_clearTransport (mamaPublisher publisher); -extern mamaTransport -mamaPublisherImpl_getTransportImpl (mamaPublisher publisher); - #if defined(__cplusplus) } #endif diff --git a/mama/c_cpp/src/cpp/MamaPublisher.cpp b/mama/c_cpp/src/cpp/MamaPublisher.cpp index 9e68f80..1a130a6 100644 --- a/mama/c_cpp/src/cpp/MamaPublisher.cpp +++ b/mama/c_cpp/src/cpp/MamaPublisher.cpp @@ -119,11 +119,11 @@ namespace Wombat } MamaPublisher::MamaPublisher (MamaPublisherImpl* impl) - : mPimpl (impl) + : mPimpl (impl) { } - MamaPublisher::MamaPublisher (void) + MamaPublisher::MamaPublisher (void) : mPimpl (new MamaPublisherImpl (this)) { } @@ -134,6 +134,7 @@ namespace Wombat const char* root) { mPimpl->create (transport, topic, source, root); + mTransport = transport; } void MamaPublisher::send (MamaMsg* msg) const @@ -178,6 +179,11 @@ namespace Wombat mPimpl->destroy (); } + MamaTransport* MamaPublisher::getTransport (void) const + { + return mTransport; + } + void MamaPublisherImpl::send (MamaMsg *msg) const { mamaTry (mamaPublisher_send (mPublisher, msg->getUnderlyingMsg ())); diff --git a/mama/c_cpp/src/cpp/mama/MamaPublisher.h b/mama/c_cpp/src/cpp/mama/MamaPublisher.h index 1f6c9da..ed6be6e 100644 --- a/mama/c_cpp/src/cpp/mama/MamaPublisher.h +++ b/mama/c_cpp/src/cpp/mama/MamaPublisher.h @@ -89,10 +89,16 @@ namespace Wombat virtual void destroy (void); + /** + * Return the MamaTransport for the MamaPublisher. + */ + virtual MamaTransport* getTransport (void) const; + protected: MamaPublisher (MamaPublisherImpl*); - + MamaPublisherImpl* mPimpl; + MamaTransport* mTransport; }; } // namespace Wombat diff --git a/mama/c_cpp/src/gunittest/c/publishertest.cpp b/mama/c_cpp/src/gunittest/c/publishertest.cpp index 651613a..e58e24d 100644 --- a/mama/c_cpp/src/gunittest/c/publishertest.cpp +++ b/mama/c_cpp/src/gunittest/c/publishertest.cpp @@ -143,3 +143,36 @@ TEST_F (MamaPublisherTestC, DISABLED_Send) ASSERT_EQ (MAMA_STATUS_OK, mama_close()); } +/* Description: Get the transport from the mamaPublisher and make sure its the same transport + * that was used to create the publisher. + * + * Expected Result: MAMA_STATUS_OK + */ +TEST_F (MamaPublisherTestC, GetTransport) +{ + mamaPublisher publisher = NULL; + mamaTransport tport = NULL; + const char* source = "SRC"; + mamaTransport aTransport = NULL; + + ASSERT_EQ (MAMA_STATUS_OK, + mamaTransport_allocate (&tport)); + + ASSERT_EQ (MAMA_STATUS_OK, + mamaTransport_create (tport, "test_tport", mBridge)); + + ASSERT_EQ (MAMA_STATUS_OK, + mamaPublisher_create (&publisher, tport, source, NULL, NULL)); + + ASSERT_EQ (MAMA_STATUS_OK, + mamaPublisher_getTransport (publisher, &aTransport)); + + ASSERT_EQ (tport, aTransport); + + ASSERT_EQ (MAMA_STATUS_OK, + mamaPublisher_destroy (publisher)); + + ASSERT_EQ (MAMA_STATUS_OK, + mamaTransport_destroy (tport)); +} + diff --git a/mama/dotnet/src/cs/MamaPublisher.cs b/mama/dotnet/src/cs/MamaPublisher.cs index 14d1be8..e5e312e 100644 --- a/mama/dotnet/src/cs/MamaPublisher.cs +++ b/mama/dotnet/src/cs/MamaPublisher.cs @@ -39,7 +39,8 @@ namespace Wombat /// when using the throttle. /// </summary> private MamaCallbackStore<MamaSendCompleteCallback, MamaThrottledSendCompleteDelegate> mCallbackStore; - private MamaMsg mReusableMsg; + private MamaMsg mReusableMsg; + private MamaTransport mReusableTransport; #endregion @@ -424,6 +425,30 @@ namespace Wombat } } + /// <summary> + /// Get the MamaTransport. + /// The result contains the reusable MamaTransport object of the + /// nativeHandle object. Applications calling this method will receive the same + /// reusable object for repeated calls on same nativeHandle object. + /// </summary> + public MamaTransport getTransport() + { + EnsurePeerCreated(); + IntPtr transport = IntPtr.Zero; + int code = NativeMethods.mamaPublisher_getTransport(nativeHandle, ref transport); + CheckResultCode(code); + + if (mReusableTransport == null) + { + mReusableTransport = new MamaTransport (transport); + } + else + { + mReusableTransport.setNativeHandle(transport); + } + return mReusableTransport; + } + // Interop API private struct NativeMethods { @@ -469,6 +494,11 @@ namespace Wombat [DllImport(Mama.DllName, CallingConvention = CallingConvention.Cdecl)] public static extern int mamaPublisher_destroy(IntPtr publisher); + + [DllImport(Mama.DllName, CallingConvention = CallingConvention.Cdecl)] + public static extern int mamaPublisher_getTransport( + IntPtr publisher, + ref IntPtr result); } private Hashtable mCallbacks = new Hashtable(); diff --git a/mama/jni/src/c/mamapublisherjni.c b/mama/jni/src/c/mamapublisherjni.c index aa1c4c6..e7172a9 100644 --- a/mama/jni/src/c/mamapublisherjni.c +++ b/mama/jni/src/c/mamapublisherjni.c @@ -49,13 +49,14 @@ typedef struct sendMsgCallback_ /****************************************************************************** * Global/Static variables *******************************************************************************/ -static jfieldID publisherPointerFieldId_g = NULL; +static jfieldID publisherPointerFieldId_g = NULL; +static jfieldID mamaTransportObjectFieldId_g = NULL; extern jfieldID transportPointerFieldId_g; extern jfieldID messagePointerFieldId_g; extern jfieldID inboxPointerFieldId_g; -static jmethodID sendCallbackMethod_g = NULL; +static jmethodID sendCallbackMethod_g = NULL;
extern JavaVM* javaVM_g; @@ -75,6 +76,47 @@ static void MAMACALLTYPE sendCompleteCB (mamaPublisher publisher, *******************************************************************************/ /* * Class: com_wombat_mama_MamaPublisher + * Method: _getTransport + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_wombat_mama_MamaPublisher__1getTransport +(JNIEnv * env, jobject this) +{ + jlong publisherPointer = 0; + mamaTransport c_result = NULL; + jobject result = NULL; + mama_status status = MAMA_STATUS_OK; + char errorString[UTILS_MAX_ERROR_STRING_LENGTH]; + + assert(publisherPointerFieldId_g!=NULL); + publisherPointer = (*env)->GetLongField(env,this,publisherPointerFieldId_g); + MAMA_THROW_NULL_PARAMETER_RETURN_VOID(publisherPointer, + "Null parameter, MamaPublisher may have already been destroyed."); + + if(MAMA_STATUS_OK!=(mamaPublisher_getTransport( + CAST_JLONG_TO_POINTER(mamaPublisher,publisherPointer), + &c_result))) + { + utils_buildErrorStringForStatus( + errorString, UTILS_MAX_ERROR_STRING_LENGTH, + "Failed to get mamaTransport from publisher.", status); + utils_throwExceptionForMamaStatus(env,status,errorString); + } + + /*re-use the existing field object */ + if (c_result) + { + result = (*env)->GetObjectField(env,this, + mamaTransportObjectFieldId_g); + assert(NULL!=result);/*throws an exception*/ + + (*env)->SetLongField(env, result, transportPointerFieldId_g, + CAST_POINTER_TO_JLONG(c_result)); + } +} + +/* + * Class: com_wombat_mama_MamaPublisher * Method: _create * Signature: (Lcom/wombat/mama/MamaTransport;Ljava/lang/String;Ljava/lang/String;)V */ @@ -444,6 +486,12 @@ JNIEXPORT void JNICALL Java_com_wombat_mama_MamaPublisher_initIDs class, "publisherPointer_i", UTILS_JAVA_POINTER_TYPE_SIGNATURE); if (!publisherPointerFieldId_g) return;/*Exception auto thrown*/ + /*The MamaTransport object.*/ + mamaTransportObjectFieldId_g = (*env)->GetFieldID(env, + class,"mamaTransport_i", + "Lcom/wombat/mama/MamaTransport;"); + if(!mamaTransportObjectFieldId_g) return; + /* get our callback class */ sendCallbackClass = (*env)->FindClass(env, "com/wombat/mama/MamaThrottleCallback"); diff --git a/mama/jni/src/com/wombat/mama/MamaPublisher.java b/mama/jni/src/com/wombat/mama/MamaPublisher.java index ccd39fb..7a3c0f3 100644 --- a/mama/jni/src/com/wombat/mama/MamaPublisher.java +++ b/mama/jni/src/com/wombat/mama/MamaPublisher.java @@ -35,6 +35,9 @@ public class MamaPublisher /*A long value containing a pointer to the underlying C publisher structure*/ private long publisherPointer_i = 0; + /* Reusable MamaTransport object. */ + private MamaTransport mamaTransport_i = null; + public void create (MamaTransport transport, String topic) { _create(transport,topic,null); @@ -81,6 +84,31 @@ public class MamaPublisher _sendFromInbox(inbox,msg); } + public MamaTransport getTransport () + { + /* Calls the native method first. This will + reuse the reusable mamaTransport in MamaPublisher + Only create the MamaTransport if we actually need to + */ + if (mamaTransport_i == null) + { + mamaTransport_i = new MamaTransport(); + } + + mamaTransport_i.setPointerVal(0); + + _getTransport (); + + if (mamaTransport_i.getPointerVal() == 0) + { + return null; + } + + return mamaTransport_i; + } + + private native void _getTransport (); + private native void _create (MamaTransport transport, String topic, String source); private native void _send (MamaMsg msg); diff --git a/mama/jni/src/com/wombat/mama/MamaTransport.java b/mama/jni/src/com/wombat/mama/MamaTransport.java index aef2282..a9c9651 100644 --- a/mama/jni/src/com/wombat/mama/MamaTransport.java +++ b/mama/jni/src/com/wombat/mama/MamaTransport.java @@ -410,6 +410,11 @@ public class MamaTransport return transportPointer_i; } + protected void setPointerVal(long pointerVal) + { + transportPointer_i = pointerVal; + } + public void create (MamaBridge bridge) { myBridge = bridge; -- 2.1.0
Gary Molloy – SR Labs Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD
|
||||
|
||||
Re: [PATCH 1/3] [MAMAC] mamaPlugin Feature - additional
Glenn McClements <g.mcclements@...>
Hi Keith,
Sorry forgot to follow this up on thread as we’ve caught up elsewhere, but for the benefit of everyone else on the list in answer to your question:
- What was the logic behind selection of the points where plug-in hooks can get called?
I think most of the answers are on another part of thread (copied below). For entitlements the first pass would be to remove the existing callouts to DART and replace them with plugin calls. This could then be extended to support server side entitlements as plugin hooks can be added easily.
---
To give some background on this change, it’s a first pass at a plugin framework that I hope to build on to allow OpenMAMA to become much more of a flexible framework.
The initial hooks were there because of an immediate need, but I’d like to get feedback on where else people would find hooks useful. One area which I’d like to explore is for pluggable entitlements. Using the plugin framework rather than the bridge mechanism:
- the plugins are already dynamic in the sense that any can be loaded at runtime
- there is the concept of optional functions, so that a plugin can implement as many or as few hooks as they wish. We can also add new hooks without breaking compatibility.
- the hooks are multi purpose, and multiple plugins can be called from the same hook
----
Glenn
From: <openmama-dev-bounces@...> on behalf of Keith Rudd
Date: Monday, 11 May 2015 14:30 To: Gary Molloy, "openmama-dev@..." Subject: Re: [Openmama-dev] [PATCH 1/3] [MAMAC] mamaPlugin Feature - additional Classification: Public Thanks for forwarding the doc Gary.
I found the mamaPlugin details an interesting read.
One question: - What was the logic behind selection of the points where plug-in hooks can get called?
I was thinking of a case where you used this as a way of having a custom entitlements implementation. In this sense, the hook at the point of mamaPublisher_send() makes sense because you could use that to implement publishing entitlements control, which is lacking in OpenMAMA.
However, there’s no hook at the point of mamaSubscription_create(), so you’d have to rely on the existing OpenMAMA hook (OEA Client interface) to check subscriber entitlements. It’s possible to do both of course but this leads to a rather in-elegant hybrid solution mixing the OEA client interface plus use of a custom hook library.
Probably better to be able to do one or the other entirely. (So extend OEAClient interface, or add plug in hook at ALL the points where entitlement checking might be relevant)
Were there some other particular use cases in mind that drove the selection of plugin hook points?
Regards, Keith
From:
openmama-dev-bounces@... [mailto:openmama-dev-bounces@...]
On Behalf Of Gary Molloy
Hi Guys,
As promised, please find below a link to a document on the mamaPlugin feature: https://docs.google.com/document/d/1HcV43uFJrV_pX0M0N7oDoZkWly0LjmyIxM9U-YpBtFQ/edit?usp=sharing Thanks, Gary
From: Gary Molloy
Sent: 30 April 2015 10:58 To: openmama-dev@... Subject: RE: [PATCH 1/3] [MAMAC] mamaPlugin Feature - additional
From 76a6db152998cbb32de58eb1cb9d6c1ab9307a1e Mon Sep 17 00:00:00 2001 From: Gary Molloy <g.molloy@...> Date: Wed, 29 Apr 2015 13:05:23 -0400 Subject: [PATCH] [MAMAC] mamaPlugin Feature - addition
Addition to the existing mamaPlugin patch to remove references to internal shared objects and a missing null check.
Signed-off-by: Gary Molloy <g.molloy@...> --- mama/c_cpp/src/c/plugin.c | 61 ++++++++++++++++++++------------------------ 1 files changed, 28 insertions(+), 33 deletions(-)
diff --git a/mama/c_cpp/src/c/plugin.c b/mama/c_cpp/src/c/plugin.c index b6475fe..303ab9f 100644 --- a/mama/c_cpp/src/c/plugin.c +++ b/mama/c_cpp/src/c/plugin.c @@ -216,9 +216,6 @@ mama_initPlugins(void) } }
- mama_log (MAMA_LOG_LEVEL_FINE, "mama_initPlugins(): Initialising mamacenterprise"); - mama_loadPlugin ("mamacenterprise"); - return MAMA_STATUS_OK; }
@@ -243,15 +240,10 @@ mama_loadPlugin (const char* pluginName) if (pluginImpl == NULL) { /* The plugin name should be of the format mamaplugin<name> */ - if (strncmp(pluginName, "mamacenterprise", MAX_PLUGIN_STRING) == 0) - snprintf(loadPluginName, MAX_PLUGIN_STRING, - "%s", - pluginName); - else - snprintf(loadPluginName, MAX_PLUGIN_STRING, - "%s%s", - PLUGIN_NAME, - pluginName); + snprintf(loadPluginName, MAX_PLUGIN_STRING, + "%s%s", + PLUGIN_NAME, + pluginName);
pluginLib = openSharedLib (loadPluginName, NULL);
@@ -345,31 +337,34 @@ mama_shutdownPlugins (void)
for (plugin = 0; plugin <= gPluginNo; plugin++) { - if (gPlugins[plugin]->mPluginHandle != NULL) + if (gPlugins[plugin] != NULL) { - /* Fire the user shutdown hook first - if one is present */ - if (gPlugins[plugin]->mamaPluginShutdownHook != NULL) + if (gPlugins[plugin]->mPluginHandle != NULL) { - gPlugins[plugin]->mamaPluginShutdownHook (gPlugins[plugin]->mPluginInfo); - } + /* Fire the user shutdown hook first - if one is present */ + if (gPlugins[plugin]->mamaPluginShutdownHook != NULL) + { + gPlugins[plugin]->mamaPluginShutdownHook (gPlugins[plugin]->mPluginInfo); + }
- ret = closeSharedLib (gPlugins[plugin]->mPluginHandle); - if (0!=ret) - { - mama_log (MAMA_LOG_LEVEL_WARN, - "mama_shutdownPlugins(): Failed to close Mama Plugin [%s]", - gPlugins[plugin]->mPluginName); - } - else - { - mama_log (MAMA_LOG_LEVEL_WARN, - "mama_shutdownPlugins(): Mama Plugin [%s] successfully closed", - gPlugins[plugin]->mPluginName); - } + ret = closeSharedLib (gPlugins[plugin]->mPluginHandle); + if (0!=ret) + { + mama_log (MAMA_LOG_LEVEL_WARN, + "mama_shutdownPlugins(): Failed to close Mama Plugin [%s]", + gPlugins[plugin]->mPluginName); + } + else + { + mama_log (MAMA_LOG_LEVEL_WARN, + "mama_shutdownPlugins(): Mama Plugin [%s] successfully closed", + gPlugins[plugin]->mPluginName); + }
- free ((char*)gPlugins[plugin]->mPluginName); - free (gPlugins[plugin]); - gPlugins[plugin] = NULL; + free ((char*)gPlugins[plugin]->mPluginName); + free (gPlugins[plugin]); + gPlugins[plugin] = NULL; + } } } return status; -- 1.7.1
From:
openmama-dev-bounces@... [mailto:openmama-dev-bounces@...]
On Behalf Of Gary Molloy
Testing Strategy:- Using the attached template you can create your own plugin and load it in via your mama.properties, for example:
mama.plugin.name_0=template
You can run up a mamaPublisher to test your plugin, for example:
mamapublisherc -tport pub -m wmw -l MAMA_INBOUND_TOPIC -v -v -v -v -v
You can expect to see output similar this if your plugin was loaded successfully:
2015-04-09 13:45:02: (f9018280) : mama_initPlugins(): Initialising [mama.plugin.name_0] template 2015-04-09 13:45:02: (f9018280) : mama_loadPlugin(): Sucessfully registered plugin functions for [template] 2015-04-09 13:45:02: (f9018280) : mama_loadPlugin(): Successfully run the init hook for mama plugin [template]
If your plugin was not loaded successful you can expect to see output similar to this:
2015-04-09 13:45:02: (f9018280) : mama_initPlugins(): Initialising [mama.plugin.name_0] template 2015-04-09 13:45:02: (f9018280) : mamaPlugin_registerFunctions(): Cannot load plugin, does not implement required function: [templateMamaPlugin_shutdownHook] 2015-04-09 13:45:02: (f9018280) : mama_loadPlugin(): Failed to register plugin functions for [template]
Further documentation on the mamaPlugin feature will be available shortly which will provide more details on the feature which will include the various hooks available etc...
=========================================================================================================
From e2a6a3f9c5750cee780cb6185a1310b4e4b70629 Mon Sep 17 00:00:00 2001 From: Gary Molloy <g.molloy@...> Date: Thu, 23 Apr 2015 11:22:14 -0400 Subject: [PATCH 1/3] [MAMAC] mamaPlugin Feature
A new feature, mamaPlugin has been introduced that will allow you to create and run your own code within 'hooks' into the MAMA codebase.
A mamaPlugin is essentially a shared object.
Signed-off-by: Gary Molloy <g.molloy@...> --- mama/c_cpp/src/c/Makefile.am | 1 + mama/c_cpp/src/c/SConscript | 1 + mama/c_cpp/src/c/SConscript.win | 1 + mama/c_cpp/src/c/mama.c | 10 +- mama/c_cpp/src/c/mama/types.h | 10 + mama/c_cpp/src/c/plugin.c | 472 +++++++++++++++++++++++++++++++++++++++ mama/c_cpp/src/c/plugin.h | 59 +++++ mama/c_cpp/src/c/publisher.c | 10 + mama/c_cpp/src/c/transport.c | 21 ++- 9 files changed, 579 insertions(+), 6 deletions(-) create mode 100644 mama/c_cpp/src/c/plugin.c create mode 100644 mama/c_cpp/src/c/plugin.h
diff --git a/mama/c_cpp/src/c/Makefile.am b/mama/c_cpp/src/c/Makefile.am index c831ce4..318c353 100644 --- a/mama/c_cpp/src/c/Makefile.am +++ b/mama/c_cpp/src/c/Makefile.am @@ -131,6 +131,7 @@ libmama_la_SOURCES = \ mamaStrUtils.h \ mamaStrUtils.c \ marketdata.c \ + plugin.c \ middleware.c \ msg.c \ msgfield.c \ diff --git a/mama/c_cpp/src/c/SConscript b/mama/c_cpp/src/c/SConscript index 4362f50..f47e18c 100644 --- a/mama/c_cpp/src/c/SConscript +++ b/mama/c_cpp/src/c/SConscript @@ -98,6 +98,7 @@ libmama_sources = \ mama.c mamaStrUtils.c marketdata.c + plugin.c middleware.c msg.c msgfield.c diff --git a/mama/c_cpp/src/c/SConscript.win b/mama/c_cpp/src/c/SConscript.win index 77e3e18..9a6ff05 100644 --- a/mama/c_cpp/src/c/SConscript.win +++ b/mama/c_cpp/src/c/SConscript.win @@ -50,6 +50,7 @@ dqpublishermanager.c inbox.c msgtype.c msgutils.c +plugin.c senderId.c reservedfields.c subscription.c diff --git a/mama/c_cpp/src/c/mama.c b/mama/c_cpp/src/c/mama.c index 33a0768..5e31856 100644 --- a/mama/c_cpp/src/c/mama.c +++ b/mama/c_cpp/src/c/mama.c @@ -35,6 +35,7 @@ #include <payloadbridge.h> #include <property.h> #include <platform.h> +#include <plugin.h>
#include "fileutils.h" #include "reservedfieldsimpl.h" @@ -42,7 +43,6 @@ #include <mama/stat.h> #include <mama/statfields.h> #include <statsgeneratorinternal.h> -#include <statsgeneratorinternal.h> #include <mama/statscollector.h> #include "transportimpl.h"
@@ -740,6 +740,9 @@ mama_openWithPropertiesCount (const char* path, } }
+ /* This will initialise all plugins */ + mama_initPlugins(); + prop = properties_Get (gProperties, "mama.catchcallbackexceptions.enable"); if (prop != NULL && strtobool(prop)) { @@ -1253,9 +1256,12 @@ mama_closeCount (unsigned int* count) gImpl.myPayloadLibraries[(uint8_t)payload] = NULL; } } - + gDefaultPayload = NULL;
+ /* This will shutdown all plugins */ + mama_shutdownPlugins(); + /* Look for a bridge for each of the middlewares and close them */ for (middleware = 0; middleware != MAMA_MIDDLEWARE_MAX; ++middleware) { diff --git a/mama/c_cpp/src/c/mama/types.h b/mama/c_cpp/src/c/mama/types.h index 50d6608..03f6da8 100644 --- a/mama/c_cpp/src/c/mama/types.h +++ b/mama/c_cpp/src/c/mama/types.h @@ -74,6 +74,16 @@ typedef struct mamaBridgeImpl_* mamaBridge; typedef struct mamaPayloadBridgeImpl_* mamaPayloadBridge;
/** + * @brief Container for holding a mama plugin object + */ +typedef struct mamaPluginImpl_* mamaPlugin; + +/** + * @brief Container for holding a mama plugin info + */ +typedef void* mamaPluginInfo; + +/** * Flexible date/time format */ typedef mama_u64_t* mamaDateTime; diff --git a/mama/c_cpp/src/c/plugin.c b/mama/c_cpp/src/c/plugin.c new file mode 100644 index 0000000..b6475fe --- /dev/null +++ b/mama/c_cpp/src/c/plugin.c @@ -0,0 +1,472 @@ +/* $Id$ + * + * OpenMAMA: The open middleware agnostic messaging API + * Copyright (C) 2011 NYSE Technologies, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include <string.h> +#include <stdio.h> +#include <limits.h> + +#include "wombat/port.h" +#include "wombat/environment.h" +#include "wombat/strutils.h" +#include <wombat/wtable.h> + +#include <mama/mama.h> +#include <mama/error.h> +#include <mamainternal.h> +#include <mama/version.h> +#include <property.h> +#include <plugin.h> +#include <platform.h> + +#define PLUGIN_PROPERTY "mama.plugin.name_" +#define PLUGIN_NAME "mamaplugin" + +#define MAX_PLUGINS 100 +#define MAX_PLUGIN_STRING 1024 + +#define MAX_FUNC_STRING 256 + +/** + * @brief Mechanism for registering required plugin functions. + * + * Taking a function string name search the shared library handle, using the + * loadLibFunc portability method, for the function. If it is found, set the + * appropriate function pointer in the plugin struct to the result. If not, + * log as an error the fact that the funciton cannot be found, and return + * MAMA_STATUS_PLATFORM + * + * @param FUNCSTRINGNAME The string function name. + * @param FUNCIMPLNAME The name of the function pointer in the plugin struct + * @param FUNCIMPLTYPE The type of the function pointer expected. + */ +#define REGISTER_PLUGIN_FUNCTION(FUNCSTRINGNAME, FUNCIMPLNAME, FUNCIMPLTYPE) \ +do { \ + snprintf (functionName, MAX_FUNC_STRING, "%s"#FUNCSTRINGNAME, name); \ + result = loadLibFunc (pluginLib, functionName); \ + \ + if (NULL != result) { \ + (pluginImpl)->FUNCIMPLNAME = *(FUNCIMPLTYPE*)&result; \ + result = NULL; \ + } else { \ + mama_log (MAMA_LOG_LEVEL_ERROR, \ + "mamaPlugin_registerFunctions(): " \ + "Cannot load plugin, does not implement required function: [%s]",\ + functionName); \ + status = MAMA_STATUS_PLATFORM; \ + return status; \ + } \ +} while (0) + +/** + * @brief Mechanism for registering required plugin functions. + * + * Taking a function string name search the shared library handle, using the + * loadLibFunc portability method, for the function. If it is found, set the + * appropriate function pointer in the plugin struct to the result. If not + * log the fact that the function has not been found, and continue. + * + * @param FUNCSTRINGNAME The string function name. + * @param FUNCIMPLNAME The name of the function pointer in the plugin struct + * @param FUNCIMPLTYPE The type of the function pointer expected. + */ +#define REGISTER_OPTIONAL_PLUGIN_FUNCTION(FUNCSTRINGNAME, \ + FUNCIMPLNAME, \ + FUNCIMPLTYPE) \ +do { \ + snprintf (functionName, MAX_FUNC_STRING, "%s"#FUNCSTRINGNAME, name); \ + result = loadLibFunc (pluginLib, functionName); \ + \ + if (NULL != result) { \ + (pluginImpl)->FUNCIMPLNAME = *(FUNCIMPLTYPE*)&result; \ + result = NULL; \ + } else { \ + mama_log (MAMA_LOG_LEVEL_FINE, \ + "mamaPlugin_registerFunctions(): " \ + "Optional plugin function [%s] not found. Unavailable.", \ + functionName); \ + } \ +} while (0) + +typedef struct mamaPluginImpl_ +{ + LIB_HANDLE mPluginHandle; + char* mPluginName; + mamaPluginInfo mPluginInfo; + + mamaPlugin_publisherPreSendHook mamaPluginPublisherPreSendHook; + mamaPlugin_transportPostCreateHook mamaPluginTransportPostCreateHook; + mamaPlugin_shutdownHook mamaPluginShutdownHook; + mamaPlugin_initHook mamaPluginInitHook; + +} mamaPluginImpl; + +static mamaPluginImpl* gPlugins[MAX_PLUGINS]; +static volatile int gPluginNo = 0; + +/** + * @brief Used to load register all possible plugin functions to be + * used within Mama. + * + * param[in] pluginLib + * param[in] name + * param[in] pluginImpl The plugin impl to be used + * + * @return mama_status return code can be one of: + * MAMA_STATUS_OK + */ +mama_status +mamaPlugin_registerFunctions (LIB_HANDLE pluginLib, + const char* name, + mamaPluginInfo pluginInfo, + mamaPluginImpl* pluginImpl); + +/** + * @brief Used find a plugin using the library name + * + * param[in] name + * + * @return a valid mamaPluginImpl if found + */ +mamaPluginImpl* +mamaPlugin_findPlugin (const char* name); + +/** + * @brief Used find a plugin using the library name + * + * param[in] pluginName + * + * @return mama_status return code can be one of: + * MAMA_STATUS_OK + */ +mama_status +mama_loadPlugin (const char* pluginName); + + +/** + * Register function pointers associated with a specific plugin. + */ +mama_status +mamaPlugin_registerFunctions (LIB_HANDLE pluginLib, + const char* name, + mamaPluginInfo pluginInfo, + mamaPluginImpl* pluginImpl) +{ + mama_status status = MAMA_STATUS_OK; + void* result = NULL; + char functionName[MAX_FUNC_STRING]; + + /* Save off some informatin on the plugin */ + pluginImpl->mPluginHandle = pluginLib; + pluginImpl->mPluginName = strdup(name); + pluginImpl->mPluginInfo = pluginInfo; + + + /* Required fuctions */ + REGISTER_PLUGIN_FUNCTION (MamaPlugin_initHook, mamaPluginInitHook, + mamaPlugin_initHook); + REGISTER_PLUGIN_FUNCTION (MamaPlugin_shutdownHook, mamaPluginShutdownHook, + mamaPlugin_shutdownHook); + + + /* Optional fuctions */ + REGISTER_OPTIONAL_PLUGIN_FUNCTION (MamaPlugin_publisherPreSendHook, mamaPluginPublisherPreSendHook, + mamaPlugin_publisherPreSendHook); + REGISTER_OPTIONAL_PLUGIN_FUNCTION (MamaPlugin_transportPostCreateHook, mamaPluginTransportPostCreateHook, + mamaPlugin_transportPostCreateHook); + + return status; +} + +mama_status +mama_initPlugins(void) +{ + int pluginCount = 0; + const char* prop = NULL; + char propString[MAX_PLUGIN_STRING]; + + for (pluginCount = 0; pluginCount < MAX_PLUGINS; pluginCount++) + { + snprintf(propString, MAX_PLUGIN_STRING, + PLUGIN_PROPERTY"%d", + pluginCount); + + prop = properties_Get (mamaInternal_getProperties (), propString); + if (prop != NULL && strlen(prop)!= 0) + { + mama_log (MAMA_LOG_LEVEL_FINE, "mama_initPlugins(): Initialising [%s] %s", propString, prop); + mama_loadPlugin (prop); + } + } + + mama_log (MAMA_LOG_LEVEL_FINE, "mama_initPlugins(): Initialising mamacenterprise"); + mama_loadPlugin ("mamacenterprise"); + + return MAMA_STATUS_OK; +} + +mama_status +mama_loadPlugin (const char* pluginName) +{ + LIB_HANDLE pluginLib = NULL; + mamaPluginImpl* pluginImpl = NULL; + mama_status status = MAMA_STATUS_OK; + mamaPluginInfo pluginInfo = NULL; + char loadPluginName [MAX_PLUGIN_STRING]; + mamaPluginImpl* aPluginImpl = NULL; + + if (!pluginName) + return MAMA_STATUS_NULL_ARG; + + pluginImpl = mamaPlugin_findPlugin(pluginName); + + /* + * Check to see if pluginImpl has already been loaded + */ + if (pluginImpl == NULL) + { + /* The plugin name should be of the format mamaplugin<name> */ + if (strncmp(pluginName, "mamacenterprise", MAX_PLUGIN_STRING) == 0) + snprintf(loadPluginName, MAX_PLUGIN_STRING, + "%s", + pluginName); + else + snprintf(loadPluginName, MAX_PLUGIN_STRING, + "%s%s", + PLUGIN_NAME, + pluginName); + + pluginLib = openSharedLib (loadPluginName, NULL); + + if (!pluginLib) + { + + mama_log (MAMA_LOG_LEVEL_ERROR, + "mama_loadPlugin(): " + "Could not open plugin library [%s] [%s]", + pluginName, + getLibError()); + return MAMA_STATUS_PLATFORM; + } + + /* Create structure to hold plugin information */ + aPluginImpl = (mamaPluginImpl*)calloc (1, sizeof(mamaPluginImpl)); + + status = mamaPlugin_registerFunctions (pluginLib, + pluginName, + pluginInfo, + aPluginImpl); + + if (MAMA_STATUS_OK == status) + { + mama_log (MAMA_LOG_LEVEL_NORMAL, + "mama_loadPlugin(): " + "Sucessfully registered plugin functions for [%s]", + pluginName); + + } + else + { + mama_log (MAMA_LOG_LEVEL_WARN, + "mama_loadPlugin(): " + "Failed to register plugin functions for [%s]", + pluginName); + + closeSharedLib (aPluginImpl->mPluginHandle); + + free ((char*)aPluginImpl->mPluginName); + free ((mamaPluginImpl*)aPluginImpl); + + return status; + } + + /* Invoke the init function */ + status = aPluginImpl->mamaPluginInitHook (aPluginImpl->mPluginInfo); + + if (MAMA_STATUS_OK == status) + { + mama_log (MAMA_LOG_LEVEL_NORMAL, + "mama_loadPlugin(): Successfully run the init hook for mama plugin [%s]", + aPluginImpl->mPluginName); + } + else + { + mama_log (MAMA_LOG_LEVEL_WARN, + "mama_loadPlugin(): Init hook failed for mama plugin [%s]", + aPluginImpl->mPluginName); + + closeSharedLib (aPluginImpl->mPluginHandle); + + free ((char*)aPluginImpl->mPluginName); + free ((mamaPluginImpl*)aPluginImpl); + + return status; + } + + /* Save off the plugin impl and increment the plugin counter */ + gPlugins[gPluginNo] = aPluginImpl; + gPluginNo++; + + } + else + { + mama_log (MAMA_LOG_LEVEL_NORMAL, + "mama_loadPlugin(): " + "Plugin [%s] has already been loaded and initialised", + pluginName); + } + + return MAMA_STATUS_OK; +} + +mama_status +mama_shutdownPlugins (void) +{ + mama_status status = MAMA_STATUS_OK; + int plugin = 0; + int ret = 0; + + for (plugin = 0; plugin <= gPluginNo; plugin++) + { + if (gPlugins[plugin]->mPluginHandle != NULL) + { + /* Fire the user shutdown hook first - if one is present */ + if (gPlugins[plugin]->mamaPluginShutdownHook != NULL) + { + gPlugins[plugin]->mamaPluginShutdownHook (gPlugins[plugin]->mPluginInfo); + } + + ret = closeSharedLib (gPlugins[plugin]->mPluginHandle); + if (0!=ret) + { + mama_log (MAMA_LOG_LEVEL_WARN, + "mama_shutdownPlugins(): Failed to close Mama Plugin [%s]", + gPlugins[plugin]->mPluginName); + } + else + { + mama_log (MAMA_LOG_LEVEL_WARN, + "mama_shutdownPlugins(): Mama Plugin [%s] successfully closed", + gPlugins[plugin]->mPluginName); + } + + free ((char*)gPlugins[plugin]->mPluginName); + free (gPlugins[plugin]); + gPlugins[plugin] = NULL; + } + } + return status; +} + +mama_status +mamaPlugin_firePublisherPreSendHook (mamaPublisher publisher, mamaMsg message) +{ + mama_status status = MAMA_STATUS_OK; + int plugin = 0; + + for (plugin = 0; plugin <= gPluginNo; plugin++) + { + if (gPlugins[plugin] != NULL) + { + if (gPlugins[plugin]->mamaPluginPublisherPreSendHook != NULL) + { + status = gPlugins[plugin]->mamaPluginPublisherPreSendHook (gPlugins[plugin]->mPluginInfo, publisher, message); + + if (MAMA_STATUS_OK != status) + { + mama_log (MAMA_LOG_LEVEL_WARN, + "mamaPlugin_firePublisherPreSendHook(): Publisher pre send hook failed for mama plugin [%s]", + gPlugins[plugin]->mPluginName); + } + } + } + } + return status; +} + +mama_status +mamaPlugin_fireTransportPostCreateHook (mamaTransport transport) +{ + mama_status status = MAMA_STATUS_OK; + int plugin = 0; + + for (plugin = 0; plugin <= gPluginNo; plugin++) + { + if (gPlugins[plugin] != NULL) + { + if (gPlugins[plugin]->mamaPluginTransportPostCreateHook != NULL) + { + status = gPlugins[plugin]->mamaPluginTransportPostCreateHook (gPlugins[plugin]->mPluginInfo, transport); + + if (MAMA_STATUS_OK != status) + { + mama_log (MAMA_LOG_LEVEL_WARN, + "mamaPlugin_fireTransportPostCreateHook(): Transport post create hook failed for mama plugin [%s]", + gPlugins[plugin]->mPluginName); + } + } + } + } + return status; +} + +mama_status +mamaPlugin_fireShutdownHook (void) +{ + mama_status status = MAMA_STATUS_OK; + int plugin = 0; + + for (plugin = 0; plugin <= gPluginNo; plugin++) + { + if (gPlugins[plugin] != NULL) + { + if (gPlugins[plugin]->mamaPluginShutdownHook != NULL) + { + status = gPlugins[plugin]->mamaPluginShutdownHook (gPlugins[plugin]->mPluginInfo); + + if (MAMA_STATUS_OK != status) + { + mama_log (MAMA_LOG_LEVEL_WARN, + "mamaPlugin_fireShutdownHook(): Shutdown hook failed for mama plugin [%s]", + gPlugins[plugin]->mPluginName); + } + } + } + } + return status; +} + +mamaPluginImpl* +mamaPlugin_findPlugin (const char* name) +{ + int plugin = 0; + + for (plugin = 0; plugin <= gPluginNo; plugin++) + { + if (gPlugins[plugin]) + { + if ((strncmp(gPlugins[plugin]->mPluginName, name, MAX_PLUGIN_STRING) == 0)) + { + return gPlugins[plugin]; + } + } + } + return NULL; +} diff --git a/mama/c_cpp/src/c/plugin.h b/mama/c_cpp/src/c/plugin.h new file mode 100644 index 0000000..df43b27 --- /dev/null +++ b/mama/c_cpp/src/c/plugin.h @@ -0,0 +1,59 @@ +/* $Id$ + * + * OpenMAMA: The open middleware agnostic messaging API + * Copyright (C) 2011 NYSE Technologies, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#ifndef PluginH__ +#define PluginH__ + + +/** + * @brief Containers used within the mama plugin + */ +typedef mama_status (*mamaPlugin_publisherPreSendHook) (mamaPluginInfo pluginInfo, mamaPublisher publisher, mamaMsg message); +typedef mama_status (*mamaPlugin_transportPostCreateHook) (mamaPluginInfo pluginInfo, mamaTransport transport); +typedef mama_status (*mamaPlugin_shutdownHook) (mamaPluginInfo pluginInfo); +typedef mama_status (*mamaPlugin_initHook) (mamaPluginInfo* pluginInfo); + +/** + * Initialize the internal plugin interface + * + * @return mama status code + */ +extern mama_status +mama_initPlugins (void); + +/** + * Shutdown the internal plugin interface + * + * @return mama status code + */ +extern mama_status +mama_shutdownPlugins (void); + +extern mama_status +mamaPlugin_firePublisherPreSendHook (mamaPublisher publisher, mamaMsg message); + +extern mama_status +mamaPlugin_fireTransportPostCreateHook (mamaTransport transport); + +extern mama_status +mamaPlugin_fireShutdownHook (void); + +#endif /* PluginH__ */ diff --git a/mama/c_cpp/src/c/publisher.c b/mama/c_cpp/src/c/publisher.c index 4612d17..6a7f92d 100644 --- a/mama/c_cpp/src/c/publisher.c +++ b/mama/c_cpp/src/c/publisher.c @@ -23,6 +23,7 @@ #include "mama/publisher.h"
#include "bridge.h" +#include "plugin.h" #include "throttle.h" #include "transportimpl.h"
@@ -245,6 +246,15 @@ mamaPublisher_send (mamaPublisher publisher, if (!impl->mMamaPublisherBridgeImpl) return MAMA_STATUS_INVALID_ARG; if (!impl->mBridgeImpl) return MAMA_STATUS_NO_BRIDGE_IMPL;
+ /* Calling plugin hook */ + status = mamaPlugin_firePublisherPreSendHook (publisher, msg); + if (MAMA_STATUS_OK != status) + { + mama_log (MAMA_LOG_LEVEL_ERROR, + "mamaPublisher_send(): PublisherPreSendHook failed. Not sending message."); + return status; + } + status = impl->mBridgeImpl->bridgeMamaPublisherSend (impl->mMamaPublisherBridgeImpl, msg); diff --git a/mama/c_cpp/src/c/transport.c b/mama/c_cpp/src/c/transport.c index 339dbc0..622f47d 100644 --- a/mama/c_cpp/src/c/transport.c +++ b/mama/c_cpp/src/c/transport.c @@ -25,6 +25,7 @@
#include "mama/mama.h" #include "throttle.h" +#include "plugin.h" #include "list.h" #include "transportimpl.h" #include "bridge.h" @@ -876,10 +877,22 @@ mamaTransport_create (mamaTransport transport,
if ((!self->mDisableRefresh) && (!mamaTransportInternal_disableRefreshes(name))) { - return refreshTransport_create (&self->mRefreshTransport, - (mamaTransport)self, - self->mListeners, - self->mBridgeImpl); + status = refreshTransport_create (&self->mRefreshTransport, + (mamaTransport)self, + self->mListeners, + self->mBridgeImpl); + + if (MAMA_STATUS_OK != status) + return status; + } + + /* Calling plugin hook*/ + status = mamaPlugin_fireTransportPostCreateHook (transport); + if (MAMA_STATUS_OK != status) + { + mama_log (MAMA_LOG_LEVEL_ERROR, + "mamaTransport_create(): TransportPostCreateHook failed with a status of %s", + mamaStatus_stringForStatus(status)); }
return MAMA_STATUS_OK; -- 1.7.1
Gary Molloy – SR Labs Adelaide Exchange | 24-26 Adelaide Street | Belfast | BT2 8GD
--- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures and to http://www.db.com/unitedkingdom/content/privacy.htm for information about privacy. |
||||
|
||||
Re: subscription msg queueing question
Frank Quinn <f.quinn@...>
Hi Reed,
Preventing dereference of trashed memory certainly one of the benefits. MAMA in general will try and keep context local to a single thread where possible though to avoid having to lock in the interest of performance. I'm not sure what exactly you're doing
though... When you say;
"The Tick42 bridge (and maybe others) send the sub msgs back in a thread that is not the same as the one that dequeues from the sub’s queue."
What are you defining as "the sub msgs" and where / what are you sending them to? A thread vs function diagram of your bridge would help if you have one too.
Cheers,
Frank
----- Reply message -----
From: "Alpert, Reed" <reed.alpert@...> To: "openmama-dev@..." <openmama-dev@...> Subject: [Openmama-dev] subscription msg queueing question Date: Tue, May 19, 2015 19:50 Hi,
The pdf dev guide says to only destroy a subscription from the same thread as the onMsg callbacks, or use destoryEx, which puts the destroy request on the subscription’s queue.
The Tick42 bridge (and maybe others) send the sub msgs back in a thread that is not the same as the one that dequeues from the sub’s queue. In this case the destoryEx does not protect against a cotemporal onMsg and onDestroy callback.
Does the Wombat bridge queue sub msgs so that this strategy works to prevent onMsg and onDestroy from colliding ?
Thanks,
Reed.
Reed Alpert | Corporate & Investment Bank | Market Data Services | J.P. Morgan | 4 Metrotech Center, 23rd Floor, Brooklyn, NY 11245 | T: 718.242.5198 | M: 917.414.4613 | reed.alpert@... Alternate Contact: CIB PIM Trading Technology Solutions NA | CIB_PIM_Trading_Technology_Solutions_NA@...
This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates (collectively, "JPMC"). This transmission may contain information that is proprietary, privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Although this transmission and any attachments are believed to be free of any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMC for any loss or damage arising in any way from its use. Please note that any electronic communication that is conducted within or through JPMC's systems is subject to interception, monitoring, review, retention and external production in accordance with JPMC's policy and local laws, rules and regulations; may be stored or otherwise processed in countries other than the country in which you are located; and will be treated in accordance with JPMC policies and applicable laws and regulations. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities. |
||||
|