Re: Notification for new subscriptions
Ian Bell <i.bell@...>
Can you attach the full patch for a full look?
It seems like the DQPublishermanager create callback does not directly return the closure, unlike the normal subscription / basic subscription OnCreate callback.
Therefore you should use the getclosure api to obtain it. Similar to what happens in the JNI version.
static void MAMACALLTYPE mamaDQPublisherManagerOnCreateCb (mamaDQPublisherManager manager)
JNIEnv* env = NULL;
dqcallbackClosure* closureImpl = (dqcallbackClosure*)mamaDQPublisherManager_getClosure(manager);
There is no specific documentation on creating the wrappers but in general you shold be able to work in a similar way to the existing CPP and JNI wrappers.
From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Mathias Kim
Sent: 19 February 2015 13:06
Subject: Re: [Openmama-dev] Notification for new subscriptions
I made a mistake in my previous mail. We tried to implement the dqpublishermanager, not the dqpublisher.
we put some effort into this and came up with an implementation of the dqpublisher, but the code fails when the onCreate callback is called. When we try to convert the closure pointer to an handle we get a FatalExecutionEngineError (error code 0xc0000005).
Since we have limited experience with wrapping c code for .net, we just did it in the way you did for the BasicSubscriber. As we get a callback from the c class, we think we’re on the right path. Nonetheless, the values we get back (closure) seems to point to the wrong place in the memory.
private static void onCreate(IntPtr NativeHandle, IntPtr closure)
GCHandle handle = GCHandle.FromIntPtr(closure); //code fails in this line
MamaDQPublishManagerImpl impl = (MamaDQPublishManagerImpl)handle.Target;
Therefore we ask ourselves:
- Are we doing it right?
- Is there something like a manual on how to wrap c classes for .net
- Sometimes a *impl class is used, sometime the MamaCallbackWrapper class. Where is the difference and when do you use which?
If needed, our code can be provided.
As Paul pointed out, what you would really want is DQPublisher for C#, but unfortunately there isn’t one at the moment. The reason for this is that that previously there hasn’t been a real demand as most C# applications have been on the client subscribing side, not the publishing side.
It sounds like there are a least a few people now looking for one so I’d be interested in finding out if there are others out there looking the same and if anyone if willing to contribute code in this are?
Also to clarify:
The MamaPublisher “basic" publishing ie. without sequence numbers, initial images/recaps etc or any other market data/data quality type features. The equivalent class on the subscribing side is MamaBasicSubscription.
The MamaDQPublisher and associated classes have sequence number injection, callbacks when a client subscription is made etc. The equivalent class on the subscribing side is MamaSubscription.
From what I recall there, are no .net wrappers for the DQPublisher as yet (although somewhat unfairly there are in the Java codebase!). For me as a greenfield application, it was simpler to write in C++, but I think adding those wrappers wasn’t too big a deal as they were really just wrappers along the lines of the existing code for the normal publisher.
Currently, I am trying to set up a publisher for market data with OpenMAMA in C#.
I wonder if there is a way to receive a notifcation every time my publisher accepts a new subscription from a subscriber? Is there an event thrown that I can handle?
Also, I still don't completely understand the difference between a basic publisher and an advanced publisher. In the development guide, the latter is only mentioned but never described in detail (e.g. how to use it).
No virus found in this message.