<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments for Captain Codeman</title>
	<atom:link href="http://www.captaincodeman.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.captaincodeman.com</link>
	<description>Software Developer</description>
	<lastBuildDate>Wed, 11 Jan 2012 15:57:28 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
	<item>
		<title>Comment on Running ElasticSearch as a Service on Windows 2008 x64 by J</title>
		<link>http://www.captaincodeman.com/2011/05/20/elasticsearch-windows-service-2008-x64/comment-page-1/#comment-2832</link>
		<dc:creator>J</dc:creator>
		<pubDate>Wed, 11 Jan 2012 15:57:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.captaincodeman.com/2011/05/20/elasticsearch-windows-service-2008-x64/#comment-2832</guid>
		<description>So I created an installer program and a setup tool to set the environment variables, Open firewall ports, Create a log directory and set permissions on ES_HOME.    

https://github.com/jdzurik/ESWindowsInstaller

It dose basically what you do in an install.</description>
		<content:encoded><![CDATA[<p>So I created an installer program and a setup tool to set the environment variables, Open firewall ports, Create a log directory and set permissions on ES_HOME.    </p>
<p><a href="https://github.com/jdzurik/ESWindowsInstaller" rel="nofollow">https://github.com/jdzurik/ESWindowsInstaller</a></p>
<p>It dose basically what you do in an install.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Simple Service Bus / Message Queue with MongoDB by Possible for PHP app built on top of codeigniter to connect to a MySQL AND a mongoDB database at the same time? &#124; SeekPHP.com</title>
		<link>http://www.captaincodeman.com/2011/05/28/simple-service-bus-message-queue-mongodb/comment-page-1/#comment-2788</link>
		<dc:creator>Possible for PHP app built on top of codeigniter to connect to a MySQL AND a mongoDB database at the same time? &#124; SeekPHP.com</dc:creator>
		<pubDate>Fri, 23 Sep 2011 07:03:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.captaincodeman.com/?p=291#comment-2788</guid>
		<description>[...] I want to use mongodb as a job queue to persist messages between my workers and my application servers. I&#8217;ve gotten the inspiration to do this from this tutorial: http://www.captaincodeman.com/2011/05/28/simple-service-bus-message-queue-mongodb/ [...]</description>
		<content:encoded><![CDATA[<p>[...] I want to use mongodb as a job queue to persist messages between my workers and my application servers. I&#8217;ve gotten the inspiration to do this from this tutorial: <a href="http://www.captaincodeman.com/2011/05/28/simple-service-bus-message-queue-mongodb/" rel="nofollow">http://www.captaincodeman.com/2011/05/28/simple-service-bus-message-queue-mongodb/</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Simple Service Bus / Message Queue with MongoDB by Possible for PHP app built on top of codeigniter to connect to a MySQL AND a mongoDB database at the same time? &#124; Gravity Layouts</title>
		<link>http://www.captaincodeman.com/2011/05/28/simple-service-bus-message-queue-mongodb/comment-page-1/#comment-2787</link>
		<dc:creator>Possible for PHP app built on top of codeigniter to connect to a MySQL AND a mongoDB database at the same time? &#124; Gravity Layouts</dc:creator>
		<pubDate>Fri, 23 Sep 2011 04:09:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.captaincodeman.com/?p=291#comment-2787</guid>
		<description>[...] I want to use mongodb as a job queue to persist messages between my workers and my application servers. I&#8217;ve gotten the inspiration to do this from this tutorial: http://www.captaincodeman.com/2011/05/28/simple-service-bus-message-queue-mongodb/ [...]</description>
		<content:encoded><![CDATA[<p>[...] I want to use mongodb as a job queue to persist messages between my workers and my application servers. I&#8217;ve gotten the inspiration to do this from this tutorial: <a href="http://www.captaincodeman.com/2011/05/28/simple-service-bus-message-queue-mongodb/" rel="nofollow">http://www.captaincodeman.com/2011/05/28/simple-service-bus-message-queue-mongodb/</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Simple Service Bus / Message Queue with MongoDB by Captain Codeman</title>
		<link>http://www.captaincodeman.com/2011/05/28/simple-service-bus-message-queue-mongodb/comment-page-1/#comment-2663</link>
		<dc:creator>Captain Codeman</dc:creator>
		<pubDate>Thu, 28 Jul 2011 19:08:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.captaincodeman.com/?p=291#comment-2663</guid>
		<description>I thought of another option ...

If you build a sparse index on a datetime field (e.g. the timestamp when the item was added) and then $unset this field when the item is processed then sorting the collection will only return the items that haven&#039;t been processed yet and also return them in the correct order.

The only items included in the index will be those in the queue so the index is kept smaller than if you were just using a regular index on a collection which should help performance (by keeping it in RAM).</description>
		<content:encoded><![CDATA[<p>I thought of another option &#8230;</p>
<p>If you build a sparse index on a datetime field (e.g. the timestamp when the item was added) and then $unset this field when the item is processed then sorting the collection will only return the items that haven&#8217;t been processed yet and also return them in the correct order.</p>
<p>The only items included in the index will be those in the queue so the index is kept smaller than if you were just using a regular index on a collection which should help performance (by keeping it in RAM).</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Simple Service Bus / Message Queue with MongoDB by Captain Codeman</title>
		<link>http://www.captaincodeman.com/2011/05/28/simple-service-bus-message-queue-mongodb/comment-page-1/#comment-2656</link>
		<dc:creator>Captain Codeman</dc:creator>
		<pubDate>Tue, 26 Jul 2011 15:46:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.captaincodeman.com/?p=291#comment-2656</guid>
		<description>I think the ObjectIds created by a single client (or server) are in order but if you have multiple producers with slightly different clocks then you could have some overlap because the time is the most significant part of the Id.

Normally, this doesn&#039;t affect the tailable cursor used by the server oplog as it&#039;s the only ObjectId producer and for our own queue it doesn&#039;t matter when we&#039;re reading through in natural order. Where it potentially hits is, as you say, when the cursor needs to be re-started and for this the last ObjectId read is used.

What you could do to make sure you don&#039;t lose any messages is create a new ObjectId based on the last one read but set a few seconds previously (whatever the longest time that you think the clocks could be out by). This slight-rewind should ensure that nothing was missed at the expense of re-reading a few messages when the cursor needs to be restarted. If the number of messages was so high that this was an issue then you should probably be looking at other queuing systems anyway (&lt;a href=&quot;http://www.zeromq.org/&quot; rel=&quot;nofollow&quot;&gt;ZeroMQ&lt;/a&gt; if you have a &lt;em&gt;really&lt;/em&gt; high rate).

The other problem is common with nearly all queuing systems where you *may* get repeated messages. This is caused by the problem above where the system is trying to guarantee that nothing is missed and is why most messaging systems actually guarantee &quot;at least once delivery&quot; - i.e. you may get some messages more than once and you have to handle it. Because of this, it&#039;s good to make the message handling idempotent when possible or have some recent-cache on the receiver to avoid re-processing duplicates.

So, for your options:

1). Use the last id to rewind slightly when creating the new cursor. This is quite efficient and once done you are going through in $natural order so it&#039;s quick and you get all the tailable cursor advantages (blocking on the server with immediate response for new messages etc...)

2). I don&#039;t think this is a viable option other than for very small queues. #1 should be more efficient. It is how the example starts when nothing has been read but you always have to handle the cursor dying and needing to be restarted so you&#039;ll be doing #1 anyway (I don&#039;t think .Skip() works because a capped collection wraps round so keeping track of how much to skip may be impossible).

3). You could use &#039;findAndModify&#039; or &#039;findAndRemove&#039; for this but they were slower than using a capped collection when I tried them.

4). You can actually still have a flag with the capped collection / tailable cursor as long as you are doing an in-place update (i.e. you can&#039;t add a &#039;processed&#039; flag but you could switch an existing processed flag to true). This gives you more certainty in what has and hasn&#039;t been processed in order to re-start the cursor at the expense of having to do an update for every read (which, to be fair, the example above is doing to maintain the last-read id). I don&#039;t think you need an index for this either.

Hope that helps, thanks for the interesting discussion!</description>
		<content:encoded><![CDATA[<p>I think the ObjectIds created by a single client (or server) are in order but if you have multiple producers with slightly different clocks then you could have some overlap because the time is the most significant part of the Id.</p>
<p>Normally, this doesn&#8217;t affect the tailable cursor used by the server oplog as it&#8217;s the only ObjectId producer and for our own queue it doesn&#8217;t matter when we&#8217;re reading through in natural order. Where it potentially hits is, as you say, when the cursor needs to be re-started and for this the last ObjectId read is used.</p>
<p>What you could do to make sure you don&#8217;t lose any messages is create a new ObjectId based on the last one read but set a few seconds previously (whatever the longest time that you think the clocks could be out by). This slight-rewind should ensure that nothing was missed at the expense of re-reading a few messages when the cursor needs to be restarted. If the number of messages was so high that this was an issue then you should probably be looking at other queuing systems anyway (<a href="http://www.zeromq.org/" rel="nofollow">ZeroMQ</a> if you have a <em>really</em> high rate).</p>
<p>The other problem is common with nearly all queuing systems where you *may* get repeated messages. This is caused by the problem above where the system is trying to guarantee that nothing is missed and is why most messaging systems actually guarantee &#8220;at least once delivery&#8221; &#8211; i.e. you may get some messages more than once and you have to handle it. Because of this, it&#8217;s good to make the message handling idempotent when possible or have some recent-cache on the receiver to avoid re-processing duplicates.</p>
<p>So, for your options:</p>
<p>1). Use the last id to rewind slightly when creating the new cursor. This is quite efficient and once done you are going through in $natural order so it&#8217;s quick and you get all the tailable cursor advantages (blocking on the server with immediate response for new messages etc&#8230;)</p>
<p>2). I don&#8217;t think this is a viable option other than for very small queues. #1 should be more efficient. It is how the example starts when nothing has been read but you always have to handle the cursor dying and needing to be restarted so you&#8217;ll be doing #1 anyway (I don&#8217;t think .Skip() works because a capped collection wraps round so keeping track of how much to skip may be impossible).</p>
<p>3). You could use &#8216;findAndModify&#8217; or &#8216;findAndRemove&#8217; for this but they were slower than using a capped collection when I tried them.</p>
<p>4). You can actually still have a flag with the capped collection / tailable cursor as long as you are doing an in-place update (i.e. you can&#8217;t add a &#8216;processed&#8217; flag but you could switch an existing processed flag to true). This gives you more certainty in what has and hasn&#8217;t been processed in order to re-start the cursor at the expense of having to do an update for every read (which, to be fair, the example above is doing to maintain the last-read id). I don&#8217;t think you need an index for this either.</p>
<p>Hope that helps, thanks for the interesting discussion!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Simple Service Bus / Message Queue with MongoDB by Nate</title>
		<link>http://www.captaincodeman.com/2011/05/28/simple-service-bus-message-queue-mongodb/comment-page-1/#comment-2655</link>
		<dc:creator>Nate</dc:creator>
		<pubDate>Mon, 25 Jul 2011 23:42:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.captaincodeman.com/?p=291#comment-2655</guid>
		<description>I&#039;m trying to accomplish essentially the same thing.   Thanks for sharing this code -- it really helped me get everything working together.

Have you had any problems with out of order messages getting lost?  I ask because the docs say that ObjectIds should be in &quot;mostly increasing&quot; order, but does not guarantee it.  In my application, I have many rows being inserted per second, and I&#039;ve noticed that while the order is generally increasing, it is definitely not consistent.  Therefore, every time my process restarts, and the query runs again, I lose some rows and re-process others (since some rows that were previously before the last id are now after and rows that were previously after are not greater than the last id, so they are excluded from the find).

A capped collection with a tailable cursor seems to be the perfect fit for processing lots of rows as they come in, but I can&#039;t seem to come up with a way to do it losslessly, since tailable cursors only support natural order.  It would be nice if there was &quot;resume&quot; operation that would let me set up a tailable cursor directly from an id.

My options, as I see them are:

1) Tailable cursor.  Advantages: keeps collection at a fixed size, easy/fast to process rows as they come in.  Disadvantages: Ids are not necessarily in increasing order so I lose some every time the query is run again (using &gt; last_id as a query param).  Cannot order by id since tailable cursor forces $natural sort only.

2) Tailable cursor with no find parameters.   Advantages: stable.  Disadvantages: Have to scan through whole table to get to last processed id every time query is run.  Skip() doesn&#039;t help as it scans the whole table anyway, plus I don&#039;t know how many rows to skip.

3) Regular cursor, periodic batch queries, order by increasing id.  Advantages: stable.  Disadvantages: requires index for select to be fast, which slows down inserts (I need these as fast as possible).

4) Use a flag on new rows, modifying it after its processed.  Advantages: stable.  Disadvantages: Now have update calls in addition to inserts and finds.  This definitely needs an index.

Anybody have any thoughts or suggestions?  Thanks!</description>
		<content:encoded><![CDATA[<p>I&#8217;m trying to accomplish essentially the same thing.   Thanks for sharing this code &#8212; it really helped me get everything working together.</p>
<p>Have you had any problems with out of order messages getting lost?  I ask because the docs say that ObjectIds should be in &#8220;mostly increasing&#8221; order, but does not guarantee it.  In my application, I have many rows being inserted per second, and I&#8217;ve noticed that while the order is generally increasing, it is definitely not consistent.  Therefore, every time my process restarts, and the query runs again, I lose some rows and re-process others (since some rows that were previously before the last id are now after and rows that were previously after are not greater than the last id, so they are excluded from the find).</p>
<p>A capped collection with a tailable cursor seems to be the perfect fit for processing lots of rows as they come in, but I can&#8217;t seem to come up with a way to do it losslessly, since tailable cursors only support natural order.  It would be nice if there was &#8220;resume&#8221; operation that would let me set up a tailable cursor directly from an id.</p>
<p>My options, as I see them are:</p>
<p>1) Tailable cursor.  Advantages: keeps collection at a fixed size, easy/fast to process rows as they come in.  Disadvantages: Ids are not necessarily in increasing order so I lose some every time the query is run again (using &gt; last_id as a query param).  Cannot order by id since tailable cursor forces $natural sort only.</p>
<p>2) Tailable cursor with no find parameters.   Advantages: stable.  Disadvantages: Have to scan through whole table to get to last processed id every time query is run.  Skip() doesn&#8217;t help as it scans the whole table anyway, plus I don&#8217;t know how many rows to skip.</p>
<p>3) Regular cursor, periodic batch queries, order by increasing id.  Advantages: stable.  Disadvantages: requires index for select to be fast, which slows down inserts (I need these as fast as possible).</p>
<p>4) Use a flag on new rows, modifying it after its processed.  Advantages: stable.  Disadvantages: Now have update calls in addition to inserts and finds.  This definitely needs an index.</p>
<p>Anybody have any thoughts or suggestions?  Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Introducing Embed.ly client for .NET by Captain Codeman</title>
		<link>http://www.captaincodeman.com/2011/07/15/embedly-client-dotnet/comment-page-1/#comment-2627</link>
		<dc:creator>Captain Codeman</dc:creator>
		<pubDate>Thu, 21 Jul 2011 17:13:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.captaincodeman.com/2011/07/15/embedly-client-dotnet/#comment-2627</guid>
		<description>Sorry, no - it&#039;s .NET 4.0 only at the moment because that&#039;s what I&#039;m using it with.

It should be possible to create a .NET 3.5 version though if someone wants to fork it or submit a patch.</description>
		<content:encoded><![CDATA[<p>Sorry, no &#8211; it&#8217;s .NET 4.0 only at the moment because that&#8217;s what I&#8217;m using it with.</p>
<p>It should be possible to create a .NET 3.5 version though if someone wants to fork it or submit a patch.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Introducing Embed.ly client for .NET by Marwan Roushdy</title>
		<link>http://www.captaincodeman.com/2011/07/15/embedly-client-dotnet/comment-page-1/#comment-2624</link>
		<dc:creator>Marwan Roushdy</dc:creator>
		<pubDate>Thu, 21 Jul 2011 09:18:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.captaincodeman.com/2011/07/15/embedly-client-dotnet/#comment-2624</guid>
		<description>is there a dll so that I could use it with visual studio 2008?

The nuget package only works with 2010</description>
		<content:encoded><![CDATA[<p>is there a dll so that I could use it with visual studio 2008?</p>
<p>The nuget package only works with 2010</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on When to use RenderAction vs RenderPartial with ASP.NET MVC by Brad Wilson</title>
		<link>http://www.captaincodeman.com/2009/02/21/when-to-use-renderaction-vs-renderpartial-with-asp-net-mvc/comment-page-1/#comment-2620</link>
		<dc:creator>Brad Wilson</dc:creator>
		<pubDate>Mon, 18 Jul 2011 19:00:33 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.intesoft.net/post.aspx?id=ba353b21-0cfd-4960-8c1f-510d9f4907ee#comment-2620</guid>
		<description>Html.Action is the string-returning version of Html.RenderAction (same symmetry as Html.Partial vs. Html.RenderPartial).</description>
		<content:encoded><![CDATA[<p>Html.Action is the string-returning version of Html.RenderAction (same symmetry as Html.Partial vs. Html.RenderPartial).</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Elmah Error Logging with MongoDB Official Driver by Mariano</title>
		<link>http://www.captaincodeman.com/2011/05/28/elmah-error-logging-official-10gen-mongodb-driver/comment-page-1/#comment-2596</link>
		<dc:creator>Mariano</dc:creator>
		<pubDate>Fri, 01 Jul 2011 19:09:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.captaincodeman.com/2011/05/28/elmah-error-logging-official-10gen-mongodb-driver/#comment-2596</guid>
		<description>Great Thanks!!</description>
		<content:encoded><![CDATA[<p>Great Thanks!!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

