Questions tagged [actor]
Programming model distinguished by ubiquitous asynchronous communication.
2,036
questions
0
votes
1
answer
39
views
Observer pattern with actor
I try to implement some repository that can notify about change its state.
protocol Observer {
}
actor Repository: Actor {
var observers: [Observer] = []
func add(observer: Observer) {
...
0
votes
0
answers
5
views
Actor model pattern for cross user resources transaction
I have 2 user and I want implement three actions:
Update user A resource.
Update user B resource.
Get userA and userB resources, modify both user A also user B resources.
How could I design actors ...
0
votes
1
answer
38
views
Akka Http: Calling TypedActor.context outside of a TypedActor implementation method
I'm trying to build akka http client, by using this example Test akka http client
This is my code:
trait HttpServer {
def sendAndReceive: HttpRequest => Future[HttpResponse]
}
trait ApiHandler ...
0
votes
1
answer
19
views
How to assign a property of an actor to a view controller property?
I have an actor like this:
I want to assign a value from the NewsCache actor to the ViewController, but it gives the following error:
Main actor-isolated property 'cache_data' can not be mutated from ...
-1
votes
0
answers
10
views
error :package org.sunbird.batch.actor does not exist [duplicate]
error :package org.sunbird.batch.actor does not exist
error :package org.sunbird.batch.actor does not exist while compiling & running time it build sucessfull , but after check api means api hit ...
2
votes
1
answer
41
views
Calling a method from an actor's init method
I'm trying to convert one of my classes in Swift to an actor. The current init method of my class calls another instance method to do a bunch of initialization work. After converting, here's a ...
0
votes
1
answer
50
views
How to filter an Actor object?
I have an Actor object that I want to be able to iterate and filter.
actor DataModel {
typealias Details = (passed: Bool, scores: [Int])
private(set) var data: [Int: Details] = [:]
func ...
1
vote
2
answers
103
views
Data race occurring in Swift Actor
I found a data race in my Swift app by using the Thread Sanitizer, and so I made my first attempt to fix race conditions by converting the offending class to an actor. The crash that the race was ...
0
votes
0
answers
39
views
How to make non-sendable type usable in Sendable context?
I have such code
public func webView(
_ webView: WKWebView,
didReceive challenge: URLAuthenticationChallenge,
completionHandler: @escaping (URLSession.AuthChallengeDisposition, ...
0
votes
0
answers
65
views
How do I design an Actor model?
I am trying to implement an Actor model in Java.
I have started with the following [class diagram].
As you can see, the ActorRunner created in the ActorContext is responsible for controlling the life ...
0
votes
0
answers
34
views
Unreal Engine 4.1.2 character starts again when he touches the floor with Blueprints
I want that when my character(actor) touches the floor, he will start from the starting point of the appearance using Blueprints in Unreal Engine 4.1.2
I tried to connect them(what is marked in the ...
0
votes
1
answer
34
views
Single task typed actors
I often use actors that perform a single computationally expensive task. After
completing its task this type of actors sends the result to its creator und
terminates itself afterwards.
Im am not quit ...
2
votes
1
answer
220
views
Usage of Dapr Virtual Actors vs Orleans
I was looking at virtual Actors and I pumped into Dapr and Orleans.
I understand that Dapr is a more complete framework to build a microservices architecture, where virtual actors are just one part of ...
0
votes
1
answer
97
views
Understanding the default Microsoft Orleans Grain Directory
I am attempting to understand the default Orleans Grain Directory.
https://learn.microsoft.com/en-us/dotnet/orleans/host/grain-directory
This article strongly suggests that you should use the default ...
5
votes
1
answer
227
views
How do I conform to a protocol with an actor?
When I try to define an actor that conforms to a protocol, Xcode gives me the error Actor-isolated instance method 'foo()' cannot be used to satisfy nonisolated protocol requirement. I can make the ...
0
votes
1
answer
60
views
set dask workers with an event loop for actors
Context
I am trying to instantiate a legacy data extractor by my dask worker using an actor pattern
from dask.distributed import Client
client = Client()
connector = Sharepoint(CONF.sources["...
0
votes
0
answers
22
views
How to generate mapping of ActorID to Peer in TicTacFish (Distributed Actors sample project)
In Apple's TicTacFish sample project, Step 3 provides an example of a LocalNetworkActorSystem based on Bonjour. At various points in the implementation, reference is made to building up a mapping from ...
1
vote
0
answers
100
views
Swift 6: Actor-isolated instance method can not be referenced from a non-isolated context
I need to setup a dictionary in an Actor. When I try the code the below I get a Actor-isolated instance method can not be referenced from a non-isolated context.
actor SimpleActor
{
var myDict: [...
0
votes
1
answer
71
views
Does the Actor Model make most sense when dealing with concurrent in-memory state
I've been looking into the Actor Model and Akka of late. As an OOP programmer I try to adhere to loose coupling and 'tell don't ask'. I also use messaging and events to communicate between bounded ...
0
votes
2
answers
160
views
SwiftUI: Actors and Views - Mutable capture of 'inout' parameter 'self' is not allowed in concurrently-executing code
I have my data stored in an Actor. I need to display the data on a view. The only way I have found to do this is to spin up a task to load the data by using an await command on the actor. This doesn't ...
0
votes
1
answer
50
views
Akka subsequent tells
Are messages sent by subsequent tell invocations guaranteed to be processed by the actor in the order in which they were sent?
Example:
actor ! message1
actor ! message2
Will message1 and message2 be ...
2
votes
1
answer
81
views
Understanding GlobalActor, is it guaranteed it won't execute on Main Thread
I'm learning usages of async-await and along with that read about the Global Actors. I know MainActor is GlobalActor, and if we annotate a method with @mainActor, the method will be executed on Main ...
2
votes
1
answer
219
views
Orleans slow with minimalistic use case
I'm evaluating Orleans for a new project we are starting soon.
Eventually we want to run a bunch of persistent actors, but I'm currently struggling to just get base line in memory version of orleans ...
0
votes
1
answer
80
views
Best way to call GlobalActor function from NotificationCenter Publisher
I have a GlobalActor with some methods on it that I'm using throughout my app. I'd like to be able to call a function from the actor when I receive a Notification from NotificationCenter, but can't ...
1
vote
3
answers
406
views
How can I achieve thread safety in an async method?
I am trying to read the keychain but the documentation warns me about the following:
SecItemCopyMatching blocks the calling thread, so it can cause your app’s UI to hang if called from the main ...
0
votes
1
answer
61
views
Is there any difference between Future<Terminated> returned by ActorSystem.terminate() vs ActorSystem.whenTerminated()?
I have my java application uses Akka framework for message routing. During application startup I create Actor System and then creates number of top level actors. Now while shutting down my application,...
0
votes
1
answer
48
views
Can an actor method be interacted concurrently?
I'm watching this WWDC video about Protect mutable state with Swift actors
and in one example they show how an actor method can be called concurrently
Imagine we have two different concurrent tasks ...
0
votes
1
answer
118
views
Can I call an actor's function from a @Sendable sync function?
I'm not sure if this is even possible, but I thought I should ask anyway!
I have a "UserDefaults" client and "live"/"mock" implementations of its interface (taken from a ...
0
votes
0
answers
41
views
OAuth2 "act" Actor claim using Microsoft /oauth2/v2.0/token API
Can you please help me to find how to use OAuth2 "act" (Actor) claim by using Microsoft "/oauth2/v2.0/token" API (login.microsoftonline.com) ?
I'm searching Microsoft documentation ...
0
votes
0
answers
81
views
How to fix System.ArgumentNullException when deploying Remote actor on Local Host
I am new to Akka.Net and tried to follow a simple procedure from "Remotely Deploying Actors" tutorial on the getakka.net site.
I however get a System.ArgumentNullException which says 'Value ...
1
vote
1
answer
19
views
Making a Bullet move towards a Target without following the Target using Pgzhelper in Pygame Zero
Question: How can I make a bullet move towards a target without following the target using Pgzhelper in Pygame Zero?
I wanted to share this with a lot of people that may have the same trouble using ...
0
votes
0
answers
47
views
Concurrent Processing of SKSpriteNode data in SpriteKit
I’m working on my first Swift project. It uses SpriteKit and has quite a few vehicles moving around different tracks. Each vehicle must be aware of other vehicles to avoid collisions and for ...
0
votes
0
answers
50
views
Actor Cluster Slowness when Large size messages produced by a ShardRegion proxy
We implemented Akka clustering with cluster sharding for a use case.
When we doing load testing for that, We created 1000 entity actors in a Node by cluster Sharding.(Cluster Node)
And we sends ...
0
votes
0
answers
42
views
Actor slowness in Akka Cluster when multiple threads send messages to ShardRegion with large Message size
We implemented Akka clustering with cluster sharding for a use case.When we doing load testing for that, We created 1000 entity actors in a Node by cluster Sharding. And we sends messages to that ...
2
votes
1
answer
104
views
Does an actor guarantee the same execution thread?
I'm working with sqlite so I need to guarantee the thread my calls execute on, but I don't want to use the main thread. I could subclass Thread, however that introduces a host of issues trying to ...
4
votes
1
answer
336
views
@MainActor closure does not seem to execute on the main thread deterministically
Consider the following, relatively simple Swift program:
import Foundation
func printContext(function: String = #function, line: Int = #line) {
print("At \(function):\(line): Running on \(...
2
votes
1
answer
227
views
Swift non actor isolated closures
Do escaping closure that are passed to actor method inherit actor isolation? Or they are non isolated?
For instance:
actor MyActor {
func method(_ closure: @escaping () async -> Void) {
...
0
votes
1
answer
115
views
What priority will as Task run as when the operation has the @MainActor decorator?
I'm curious what priority the async block() in the code snippet below will run as when the Task's operation is marked @MainActor?
According to the DispatchQueue docs the main queue always runs with a ...
2
votes
1
answer
252
views
Swift Actors and old dependencies
I am learning swift and trying to use the new concurrency features introduced by Swift 5.5, and to make my code conform to the new requirements that will eventually be introduced by Swift 6.
My ...
0
votes
1
answer
237
views
Wait for resource to be loaded with new swift concurrency features
Is it somehow possible to wait for resource to be loaded with new swift concurrency features. Here is an example:
enum ResourceState {
case initial
case loading
case loaded
}
actor ...
0
votes
0
answers
52
views
Akka messages wait in mailbox even when no messages are currently being processed by the actor
I'm having an issue where every so often Akka messages are being held in an actor's mailbox for longer than necessary, sometimes for up to around 3 seconds.
This is only happening when I run the app (...
0
votes
1
answer
487
views
Understanding actor and making it thread safe
I have an actor that is processing values and is then publishing the values with a Combine Publisher.
I have problems understanding actors, I thought when using actors in an async context, it would ...
0
votes
0
answers
50
views
How can i get active shards in actor cluster sharding?
Is that any way to get no of entity actors running and no of shards running in cluster sharding with java code?
I'm Using actor-cluster-sharding v 2.6.14
Inspecting Cluster Sharding State in Akka ...
0
votes
0
answers
34
views
Communication protocols between two python instances
I have a 2 python programs that run in different python instances and talk to each other.
Example:
Program 1: "Hey Program 2, copy this file and send me a report when you are over"
Program ...
1
vote
2
answers
54
views
Actors v.s. HTTP
I don’t really get if there is much of a difference between using actors and using HTTP endpoints for communication between processesses.
Documents online say all the time “actors receive messages and ...
0
votes
2
answers
379
views
Are swift actors concurrent, but not parallel?
I'm trying to figure out, what actor brings to use.
It's not clear for me - are they truly parallel or just concurrent.
I did little test to check myself:
actor SomeActor {
func check() {
...
2
votes
1
answer
194
views
Does swift actors have its own executors?
I'm looking at sources of actor. And can't determine does swift actor creates it's own executor on initialization step.
Example from swiftrocks:
actor MyActor {}
// Compiled:
final class MyActor: ...
1
vote
1
answer
180
views
Swift serial queue that only retains one pending task
I need a serial queue that instead of building up a backlog of tasks, only performs the task it's doing and the latest one queued since that started. Any job waiting in the queue for execution should ...
0
votes
1
answer
55
views
How to create and manage just enough actors to maximise CPU usage in Swift?
I often find myself having to perform lots of operations on a single resource, e.g. resizing an image to lots of different resolutions. When the resource in question is Sendable (which for example is ...
0
votes
2
answers
49
views
Create new canister or new actor motoko
I am new to motoko. As i understand an Actor in motoko is consider as a class.And I want to create multiple object from that Actor. My question is am I right about it and if the answer is yes then how ...