This receiver write into a file on each event.
See Service Configuration for detailled information to configure your service. You must declare this receiver with the <receiver> section inside a <group> section. It will looks like :
<receiver name="MyReceiverName" type="LeCouteauSuisse.Components.FileReceiver,
LeCouteauSuisseComponents, Version=1.0.0.2, Culture=neutral, PublicKeyToken=8d1037c5df6d5bd0">
This component have some parameters inside the section <settings>. Each parameter is written with a <setting> section.
Key name | Mandatory | Default value | Description |
filenameFormat | Yes | | The full path and name of the file |
filenameArguments | No | | The arguments to format filenameFormat. See Format parameters. |
appendFile | No | true | Determines whether data is to be appended to the file. If the file exists and append is false, the file is overwritten. If the file exists and appendFile is true, the data is appended to the file. Otherwise, a new file is created. |
forceOpenCloseOnEvent | No | false | Determines whether the file is open and close on each event. If forceOpenCloseOnEvent is true, the receiver open the file, write data and close the file. If forceOpenCloseOnEvent is false, the receiver open at the first access the file and close it when the service is stopping or when the name of the file change. |
headerFormat | No | | Header to write at the beginning of the file. |
headerArguments | No | | The arguments to format headerFormat. See Format parameters. |
footerFormat | No | | Footer to write at the end of the file. |
footerArguments | No | | The arguments to format footerFormat. See Format parameters. |
lineFormat | No | | The line to write for each event. |
lineArguments | No | | The arguments to format lineFormat. See Format parameters. |
Sample of configuration :
<settings>
<setting key="filenameFormat" value="c:\Temp\FileReceiver_{1}_{0:yyyyMMdd}.csv"/>
<setting key="filenameArguments" value="ReceiverContext.Name"/>
<setting key="lineFormat" value="{0:yyyyMMdd-HHmmss},{1},{2},{3}"/>
<setting key="lineArguments" value="Id,Generated,Data"/>
<setting key="headerFormat" value="Date,Event Id,Date generated,Data"/>
<setting key="headerArguments" value=""/>
<setting key="footerFormat" value=""/>
<setting key="footerArguments" value=""/>
<setting key="appendFile" value="true"/>
<setting key="forceOpenCloseOnEvent" value="false"/>
</settings>
This receiver will create a CSV file with a header "Date,Event Id,Date generated,Data" and write events inside. It create a file each day named like FileReceiver_MyReceiverName_20090623.csv.