{{Quickfixn}} help with example storing message in database thru odbc
Grant Birchmeier
gbirchmeier at connamara.com
Tue Oct 21 14:24:08 PDT 2014
I think your QF application needs to use application-level callbacks to
write to some kind of custom-storage that you implement. That custom-built
store can be a DB, no problem.
But note a caveat: Your storage operation might be kind of expensive, so yo
do not want to perform them on the QF thread. Your QF thread should shove
those messages into some sort of blocking queue, and a separate thread
should process that queue and store them into your DB.
You should not do expensive ops on the QF thread (i.e. in the callbacks).
QF callbacks happen in serial; if you spend a lot of time handing one
message, the others will start to queue up and cause connection problems.
On Tue, Oct 21, 2014 at 3:40 PM, Alberto Honorato <honorabetto at gmail.com>
wrote:
> Ok, understood, but now a question, if i want to use another application
> to read the messages so I can get some fields into its database, what would
> you suggest to implement?
>
> Thank you for your help.
>
> On Tue, Oct 21, 2014 at 3:28 PM, Grant Birchmeier <
> gbirchmeier at connamara.com> wrote:
>
>> The MessageStore and the FileStore are two completely different
>> components. It should be no problem for you to use one medium for the
>> store and another for the log.
>>
>> However, I'm concerned that you are confusing the message log with the
>> message store.
>>
>> The LogFactory creates two sets of files: the *message log* and the *event
>> log*. The *message log* contains every message sent and received; it is
>> very useful to humans. The *event log* contains status messages; it is
>> kind of useful to humans sometimes. The engine doesn't care about either
>> log file.
>>
>> *The store is something else.* It is used internally by the engine to
>> store session state in case of resend requests and such. *Humans should
>> ignore it. All other applications should ignore it too. It is only for
>> QF.* If you want to use a DB for the store, great, but that is not an
>> invitation for other apps to start messing with it.
>>
>> On Tue, Oct 21, 2014 at 3:13 PM, Alberto Honorato <honorabetto at gmail.com>
>> wrote:
>>
>>> Thanks Olamide and Ruaan, I will try your suggestions, just to clarify,
>>> I want to store the messages using the IMessageStoreFactory. I am going to
>>> use a log in a file and the messages in a database. Have you seen something
>>> similar in your projects?
>>>
>>> Thank you.
>>>
>>> On Tue, Oct 21, 2014 at 3:08 PM, Ruaan Viljoen <ruaanv at gmail.com> wrote:
>>>
>>>> Hi Alberto,
>>>>
>>>> I have a branch on my github that I just pushed some local code I had
>>>> been testing recently. It's rudimentary and incomplete, but hacked it
>>>> together along with some PostgreSQL derived classes in a testing
>>>> environment for some performance tests. Also, it uses SqlConnection instead
>>>> of OledbConnection, but you should get the gist and strip out and swap the
>>>> sections you need or extend and override where appropriate.
>>>>
>>>> I'll be finishing it off in the holiday and adding some unit tests. I'm
>>>> not sure this fits with the current direction of QuickFix/n master branch
>>>> currently, especially with the Logging interface discussions going on at
>>>> the moment, but feel free to use it if it may help.
>>>>
>>>> Regards,
>>>> Ruaan
>>>>
>>>> Ruaan Viljoen
>>>>
>>>>
>>>> On 18 October 2014 15:59, olamide olatunji <krazibit312 at gmail.com>
>>>> wrote:
>>>>
>>>>> Hi Alberto,
>>>>> Not sure the DB Logging is implemented in QuickFixN yet, but you can
>>>>> by implementing the ILogFactory
>>>>>
>>>>> On Sat, Oct 18, 2014 at 4:50 PM, Alberto Honorato <
>>>>> honorabetto at gmail.com> wrote:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I am implementing a quickfix connection with .NET. Right now the
>>>>>> messages are being saved in a text file, however for my project I need to
>>>>>> store them into an sql server database thru ODBC.
>>>>>>
>>>>>> I have been searching the web to achieve this, but I wasn't able to
>>>>>> find any example.
>>>>>>
>>>>>> Could you help me with an example, similar to the code below, that
>>>>>> stores the FIX messages into MS SQL Server?
>>>>>>
>>>>>> Thanking in advance
>>>>>>
>>>>>> Alberto Honorato
>>>>>>
>>>>>> *main**method*
>>>>>>
>>>>>> *QuickFix.SessionSettings**settings**= new**QuickFix.SessionSettings*
>>>>>> *(file);*
>>>>>> *TradeClientApp**application**= new**TradeClientApp**();*
>>>>>> *QuickFix.IMessageStoreFactory**storeFactory**= new*
>>>>>> *QuickFix.FileStoreFactory**(**settings**);*
>>>>>> *QuickFix.ILogFactory**logFactory**= new**QuickFix.FileLogFactory**(*
>>>>>> *settings**);*
>>>>>> *QuickFix.Transport.SocketInitiator**initiator**= new*
>>>>>> *QuickFix.Transport.SocketInitiator**(**application**,**storeFactory*
>>>>>> *,**settings**,**logFactory**);*
>>>>>>
>>>>>> *Configuration**file*
>>>>>>
>>>>>> *#**default**settings**for**sessions*
>>>>>> *[**DEFAULT**]*
>>>>>> *FileStorePath**=**store*
>>>>>> *FileLogPath**=**log*
>>>>>> *ConnectionType**=**initiator*
>>>>>> *ReconnectInterval**=60*
>>>>>> *SenderCompID**=******
>>>>>>
>>>>>> *#**session**definition*
>>>>>> *[**SESSION**]*
>>>>>> *#**inherit**FileStorePath**,**FileLogPath**,**ConnectionType**,*
>>>>>> *ReconnectInterval**and**SenderCompID**from**default*
>>>>>> *BeginString**=**FIX**.4.4*
>>>>>> *TargetCompID**=*****
>>>>>> *SenderCompID**=******
>>>>>> *StartTime**=01:00:00*
>>>>>> *EndTime**=23:30:00*
>>>>>> *HeartBtInt**=60*
>>>>>> *SocketConnectPort**=********
>>>>>> *SocketConnectHost**=*********
>>>>>> *DataDictionary**=../../**dictionary**/FIX44.**xml*
>>>>>> *FileLogPath**=../../**Log**/**LogFix.txt*
>>>>>> *FileStorePath**=../../**store*
>>>>>>
>>>>>>
>>>>>> ================================================================================================
>>>>>>
>>>>>>
>>>>>> *main**method*
>>>>>>
>>>>>> QuickFix.SessionSettings settings = new
>>>>>> QuickFix.SessionSettings(file);
>>>>>> TradeClientApp application = new TradeClientApp();
>>>>>> QuickFix.IMessageStoreFactory storeFactory = new
>>>>>> QuickFix.FileStoreFactory(settings);
>>>>>> QuickFix.ILogFactory logFactory = new
>>>>>> QuickFix.FileLogFactory(settings);
>>>>>> QuickFix.Transport.SocketInitiator initiator = new
>>>>>> QuickFix.Transport.SocketInitiator(application, storeFactory, settings,
>>>>>> logFactory);
>>>>>>
>>>>>> *Configuration**file*
>>>>>>
>>>>>> # default settings for sessions
>>>>>> [DEFAULT]
>>>>>> FileStorePath=store
>>>>>> FileLogPath=log
>>>>>> ConnectionType=initiator
>>>>>> ReconnectInterval=60
>>>>>> SenderCompID=*****
>>>>>>
>>>>>> # session definition
>>>>>> [SESSION]
>>>>>> # inherit FileStorePath, FileLogPath, ConnectionType,
>>>>>> ReconnectInterval and SenderCompID from default
>>>>>> BeginString=FIX.4.4
>>>>>> TargetCompID=****
>>>>>> SenderCompID=*****
>>>>>> StartTime=01:00:00
>>>>>> EndTime=23:30:00
>>>>>> HeartBtInt=60
>>>>>> SocketConnectPort=*******
>>>>>> SocketConnectHost=********
>>>>>> DataDictionary=../../dictionary/FIX44.xml
>>>>>> FileLogPath=../../Log/LogFix.txt
>>>>>> FileStorePath=../../store
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Quickfixn mailing list
>>>>>> Quickfixn at lists.quickfixn.com
>>>>>> http://lists.quickfixn.com/listinfo.cgi/quickfixn-quickfixn.com
>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Quickfixn mailing list
>>>>> Quickfixn at lists.quickfixn.com
>>>>> http://lists.quickfixn.com/listinfo.cgi/quickfixn-quickfixn.com
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> Quickfixn mailing list
>>>> Quickfixn at lists.quickfixn.com
>>>> http://lists.quickfixn.com/listinfo.cgi/quickfixn-quickfixn.com
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Quickfixn mailing list
>>> Quickfixn at lists.quickfixn.com
>>> http://lists.quickfixn.com/listinfo.cgi/quickfixn-quickfixn.com
>>>
>>>
>>
>>
>> --
>> Grant Birchmeier
>> *Connamara Systems, LLC*
>> *Made-To-Measure Trading Solutions.*
>> Exactly what you need. No more. No less.
>> http://connamara.com
>>
>> _______________________________________________
>> Quickfixn mailing list
>> Quickfixn at lists.quickfixn.com
>> http://lists.quickfixn.com/listinfo.cgi/quickfixn-quickfixn.com
>>
>>
>
> _______________________________________________
> Quickfixn mailing list
> Quickfixn at lists.quickfixn.com
> http://lists.quickfixn.com/listinfo.cgi/quickfixn-quickfixn.com
>
>
--
Grant Birchmeier
*Connamara Systems, LLC*
*Made-To-Measure Trading Solutions.*
Exactly what you need. No more. No less.
http://connamara.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quickfixn.com/pipermail/quickfixn-quickfixn.com/attachments/20141021/d65ba470/attachment-0001.htm>
More information about the Quickfixn
mailing list