Yes, you could do it with 3 agents, one to order the messages, two to do
the work :-).  I'm not sure if the STM guarantees any ordering, but you'd
probably want to be explicit.


On Tue, Jun 17, 2014 at 6:11 PM, Hussein B. <hubaghd...@gmail.com> wrote:

> you mean one agent to deliver the notifications. true?
>
>
> On Wednesday, June 18, 2014 12:01:42 AM UTC+2, Gary Trakhman wrote:
>
>> 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. <hubag...@gmail.com> 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. <hubag...@gmail.com> 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 clo...@googlegroups.com
>>>>>
>>>>> Note that posts from new members are moderated - please be patient
>>>>> with your first post.
>>>>> To unsubscribe from this group, send email to
>>>>> clojure+u...@googlegroups.com
>>>>>
>>>>> 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 clojure+u...@googlegroups.com.
>>>>>
>>>>> 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 clo...@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+u...@googlegroups.com
>>> 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 clojure+u...@googlegroups.com.
>>> 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 clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> 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 clojure+unsubscr...@googlegroups.com.
> 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to