Yea, send uses a fixed threadpool, and send-off uses a growing one, so it's
more suitable for IO-bound tasks.  I don't think there's any difference in
terms of how it looks from STM.

2 agents will have 2 independent queues, even though they might share
threadpools, if you want to guarantee order, you need one queue.


On Tue, Jun 17, 2014 at 5:54 PM, Hussein B. <[email protected]> wrote:

> I think send-off is used for IO operations, or?
>
> If an agent is started with messages [1 2 3] and then another agent
> started with messages [4 5] , is it guaranteed that messages [1 2 3] will
> be delivered before [4 5]?
>
> I'm talking about production and really concurrent system.
>
>
> On Tuesday, June 17, 2014 11:45:52 PM UTC+2, Gary Trakhman wrote:
>
>> Agent send operations inside a transaction get queued up and don't
>> actually get sent until the transaction commits, that's probably what you
>> want, it's meant for side-effects.
>>
>>
>> On Tue, Jun 17, 2014 at 5:43 PM, Hussein B. <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> I have a ServerSocket that stores the client ID and the client socket
>>> object into a ref type. And I also have a thread that is running in the
>>> background that checks if a specific condition is met, then it will start
>>> send notifications to the clients (it will use the client-id-ref and
>>> messages-ref).
>>>
>>> Of course, since both are refs; any operation needs to be run under a
>>> STM transaction.
>>>
>>> My question is, is it ok to do IO Socket operation inside a STM
>>> transaction? STM transaction might retry, this means that there are great
>>> chances that the clients will receive the notifications more than once.
>>>
>>> For Socket IO operations inside STM transaction, is better/recommended
>>> to do it using Agents? Since, AFAIK, agents inside a transaction will be
>>> executed only if the transaction is successful.
>>>
>>> Thanks.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to [email protected]
>>>
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>>
>>> For more options, visit this group at
>>> http://groups.google.com/group/clojure?hl=en
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to