Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Individual mailboxes cannot be created except via properties #99

Open
bwehrle opened this issue Jul 10, 2022 · 6 comments
Open

Individual mailboxes cannot be created except via properties #99

bwehrle opened this issue Jul 10, 2022 · 6 comments
Assignees

Comments

@bwehrle
Copy link
Contributor

bwehrle commented Jul 10, 2022

Therefore there is no way to create configurations programatically when different plugin configurations are needed. The most relevant case for this is that of the ManyToOneConcurrentArrayQueuePlugin. This mailbox type requires that there only be 1 mailbox per actor (it is M:1). See https://docs.vlingo.io/xoom-actors#mailbox - scroll to "arrayQueueMailbox" section.

As discussed with @VaughnVernon the existing system for mailbox configuration is limited to creating a single mailbox with a single given name. In the Configuration class, there is a configurationOverrides (Map<String, PluginConfiguration>). There is only one Plugin Configuration allowed per Plugin.

A better solution might include a plugin that creates a new mailbox dynamically for each actor that requests one; instead of specifying the mailbox name, the actor instantiation can request a mailbox configuration name, and an actual mailbox with this configuration can either be created or re-used, depending on the plugin configuration.

@VaughnVernon
Copy link
Contributor

VaughnVernon commented Jul 11, 2022

Hi @bwehrle We can code configure all mailbox plugins. Please see:

.with(ManyToOneConcurrentArrayQueuePluginConfiguration

@VaughnVernon
Copy link
Contributor

@bwehrle Per this Slack message from @pflueras, would you please provide clarification on your request?

#99 - I think he wants the configurations along with referenced plugins to be created 'on demand' instead of the current 'eager' creation from the startup:

the actor instantiation can request a mailbox configuration name

Neither one of us understands how you intend for this this to be used. Can you please provide a concrete use case?

@VaughnVernon
Copy link
Contributor

@bwehrle Would you please ^^^ comment on the previous two comments, or at least the last one? We don't understand how you intend to use dynamic, in-code configuration.

@VaughnVernon
Copy link
Contributor

@bwehrle Additionally I just implemented the single "arrayQueue" mailbox per actor instance. If a developer needs a kind of "shared mailbox" they can use one of the following router types:

io.vlingo.xoom.actors.BroadcastRouter<P>
io.vlingo.xoom.actors.ContentBasedRouter<P>
io.vlingo.xoom.actors.RandomRouter<P>
io.vlingo.xoom.actors.RoundRobinRouter<P>
io.vlingo.xoom.actors.SmallestMailboxRouter<P>

The implementation is in the current SNAPSHOT.

@bwehrle
Copy link
Contributor Author

bwehrle commented Jul 26, 2022

Sorry for falling behind on the threads here:

The problem with using the code configuration is that when I filed the issue the API for creating a ManyToOne mailbox did not allow the name to be specified. This was only available from properties. In addition, writing N properties is not a solution for dynamic number of actors.

I think that only leaves one options: define a type of mailbox and the properties that configure it

Let me paraphrase this with some pseudo code to make it really clear.

a = stage.createMeAnActor(actorType, MailboxSpec.from(ManyToOneMailbox.class, configProperties)) ...

Again, sorry for running behind: please ping me in gitter if I don't respond on an issue.

@VaughnVernon
Copy link
Contributor

The API has always supported creating an actor with a mailbox by name. You used it in your overflow test:

    final CountTaker countTaker =
            world.actorFor(
                    CountTaker.class,
                    Definition.has(CountTakerActor.class,
                            Definition.parameters(testResults),
                            "testArrayQueueMailbox",
                            "countTaker-2"));

Notice: Definition.has(..., "testArrayQueueMailbox", ...) and the setUp():

Properties properties = new Properties();
properties.setProperty("plugin.name.testArrayQueueMailbox", "true");
. . .
ManyToOneConcurrentArrayQueuePlugin manyToOneConcurrentArrayQueuePlugin =
 new ManyToOneConcurrentArrayQueuePlugin();

PluginProperties pluginProperties =
  new PluginProperties("testArrayQueueMailbox", properties);
. . .
manyToOneConcurrentArrayQueuePlugin.configuration().buildWith(
      world.configuration(), pluginProperties);

manyToOneConcurrentArrayQueuePlugin.start(world);

Do any of these address what you are looking for? If we are missing any Stage::actorFor(...) implementation that you need it can certainly be added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants