Merge pull request #17120 from akka/wip-15677-deprecate-microkernel-patriknw
=ker #15677 Deprecate Microkernel
This commit is contained in:
commit
54aa559fa4
22 changed files with 94 additions and 373 deletions
|
|
@ -12,21 +12,50 @@ Akka can be used in different ways:
|
||||||
- As a library: used as a regular JAR on the classpath and/or in a web app, to
|
- As a library: used as a regular JAR on the classpath and/or in a web app, to
|
||||||
be put into ``WEB-INF/lib``
|
be put into ``WEB-INF/lib``
|
||||||
|
|
||||||
- As a stand alone application by instantiating ActorSystem in a main class or
|
- Package with `sbt-native-packager <https://github.com/sbt/sbt-native-packager>`_
|
||||||
using the :ref:`Microkernel (Scala) <microkernel-scala>` / :ref:`Microkernel (Java) <microkernel-java>`
|
|
||||||
|
- Package and deploy using `Typesafe ConductR <http://typesafe.com/products/conductr>`_.
|
||||||
|
|
||||||
|
|
||||||
Using Akka as library
|
Native Packager
|
||||||
---------------------
|
===============
|
||||||
|
|
||||||
This is most likely what you want if you are building Web applications. There
|
`sbt-native-packager <https://github.com/sbt/sbt-native-packager>`_ is a tool for creating
|
||||||
are several ways you can use Akka in Library mode by adding more and more
|
distributions of any type of application, including an Akka applications.
|
||||||
modules to the stack.
|
|
||||||
|
Define sbt version in ``project/build.properties`` file:
|
||||||
|
|
||||||
|
.. code-block:: none
|
||||||
|
|
||||||
|
sbt.version=0.13.7
|
||||||
|
|
||||||
|
Add `sbt-native-packager <https://github.com/sbt/sbt-native-packager>`_ in ``project/plugins.sbt`` file:
|
||||||
|
|
||||||
|
.. code-block:: none
|
||||||
|
|
||||||
|
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.0-RC1")
|
||||||
|
|
||||||
|
Use the package settings and optionally specify the mainClass in ``build.sbt`` file:
|
||||||
|
|
||||||
|
.. includecode:: ../../../akka-samples/akka-sample-main-scala/build.sbt
|
||||||
|
|
||||||
|
|
||||||
Using Akka as a stand alone microkernel
|
.. note:: Use the ``JavaServerAppPackaging``. Don't use ``AkkaAppPackaging`` (previously named
|
||||||
----------------------------------------
|
``packageArchetype.akka_application``, since it doesn't have the same flexibility and quality
|
||||||
|
as the ``JavaServerAppPackaging``.
|
||||||
|
|
||||||
|
Use sbt task ``dist`` package the application.
|
||||||
|
|
||||||
|
To start the application (on a unix-based system):
|
||||||
|
|
||||||
|
.. code-block:: none
|
||||||
|
|
||||||
|
cd target/universal/
|
||||||
|
unzip akka-sample-main-scala-2.4-SNAPSHOT.zip
|
||||||
|
chmod u+x akka-sample-main-scala-2.4-SNAPSHOT/bin/akka-sample-main-scala
|
||||||
|
akka-sample-main-scala-2.4-SNAPSHOT/bin/akka-sample-main-scala sample.hello.Main
|
||||||
|
|
||||||
|
Use ``Ctrl-C`` to interrupt and exit the application.
|
||||||
|
|
||||||
|
On a Windows machine you can also use the ``bin\akka-sample-main-scala.bat`` script.
|
||||||
|
|
||||||
Akka can also be run as a stand-alone microkernel. See
|
|
||||||
:ref:`Microkernel (Scala) <microkernel-scala>` / :ref:`Microkernel (Java) <microkernel-java>` for
|
|
||||||
more information.
|
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,8 @@ Download
|
||||||
--------
|
--------
|
||||||
|
|
||||||
There are several ways to download Akka. You can download it as part of the Typesafe Platform
|
There are several ways to download Akka. You can download it as part of the Typesafe Platform
|
||||||
(as described above). You can download the full distribution with microkernel, which includes
|
(as described above). You can download the full distribution, which includes all modules.
|
||||||
all modules. Or you can use a build tool like Maven or SBT to download dependencies from the
|
Or you can use a build tool like Maven or SBT to download dependencies from the Akka Maven repository.
|
||||||
Akka Maven repository.
|
|
||||||
|
|
||||||
Modules
|
Modules
|
||||||
-------
|
-------
|
||||||
|
|
@ -34,9 +33,6 @@ Akka is very modular and consists of several JARs containing different features.
|
||||||
|
|
||||||
- ``akka-cluster`` – Cluster membership management, elastic routers.
|
- ``akka-cluster`` – Cluster membership management, elastic routers.
|
||||||
|
|
||||||
- ``akka-kernel`` – Akka microkernel for running a bare-bones mini application
|
|
||||||
server
|
|
||||||
|
|
||||||
- ``akka-osgi`` – base bundle for using Akka in OSGi containers, containing the
|
- ``akka-osgi`` – base bundle for using Akka in OSGi containers, containing the
|
||||||
``akka-actor`` classes
|
``akka-actor`` classes
|
||||||
|
|
||||||
|
|
@ -82,16 +78,6 @@ which includes proxies for several other repositories that Akka modules depend o
|
||||||
|
|
||||||
The use of Akka SNAPSHOTs, nightlies and milestone releases is discouraged unless you know what you are doing.
|
The use of Akka SNAPSHOTs, nightlies and milestone releases is discouraged unless you know what you are doing.
|
||||||
|
|
||||||
Microkernel
|
|
||||||
-----------
|
|
||||||
|
|
||||||
The Akka distribution includes the microkernel. To run the microkernel put your
|
|
||||||
application jar in the ``deploy`` directory and use the scripts in the ``bin``
|
|
||||||
directory.
|
|
||||||
|
|
||||||
More information is available in the documentation of the
|
|
||||||
:ref:`Microkernel (Scala) <microkernel-scala>` / :ref:`Microkernel (Java) <microkernel-java>`.
|
|
||||||
|
|
||||||
.. _build-tool:
|
.. _build-tool:
|
||||||
|
|
||||||
Using a build tool
|
Using a build tool
|
||||||
|
|
|
||||||
|
|
@ -75,12 +75,14 @@ Akka has both a :ref:`scala-api` and a :ref:`java-api`.
|
||||||
Akka can be used in two different ways
|
Akka can be used in two different ways
|
||||||
======================================
|
======================================
|
||||||
|
|
||||||
- As a library: used by a web app, to be put into ``WEB-INF/lib`` or as a regular
|
Akka can be used and deployed in different ways:
|
||||||
JAR on your classpath.
|
|
||||||
|
|
||||||
- As a microkernel: stand-alone kernel to drop your application into.
|
- As a library: used as a regular JAR on the classpath and/or in a web app, to
|
||||||
|
be put into ``WEB-INF/lib``
|
||||||
|
|
||||||
See the :ref:`deployment-scenarios` for details.
|
- Package with `sbt-native-packager <https://github.com/sbt/sbt-native-packager>`_
|
||||||
|
|
||||||
|
- Package and deploy using `Typesafe ConductR <http://typesafe.com/products/conductr>`_.
|
||||||
|
|
||||||
Commercial Support
|
Commercial Support
|
||||||
==================
|
==================
|
||||||
|
|
|
||||||
|
|
@ -19,13 +19,11 @@ but also in the size of applications it is useful for. The core of Akka, akka-ac
|
||||||
is very small and easily dropped into an existing project where you need
|
is very small and easily dropped into an existing project where you need
|
||||||
asynchronicity and lockless concurrency without hassle.
|
asynchronicity and lockless concurrency without hassle.
|
||||||
|
|
||||||
You can choose to include only the parts of akka you need in your application
|
You can choose to include only the parts of akka you need in your application.
|
||||||
and then there's the whole package, the Akka Microkernel, which is a standalone
|
With CPUs growing more and more cores every cycle, Akka is the alternative that
|
||||||
container to deploy your Akka application in. With CPUs growing more and more
|
provides outstanding performance even if you're only running it on one machine.
|
||||||
cores every cycle, Akka is the alternative that provides outstanding performance
|
Akka also supplies a wide array of concurrency-paradigms, allowing users to choose
|
||||||
even if you're only running it on one machine. Akka also supplies a wide array
|
the right tool for the job.
|
||||||
of concurrency-paradigms, allowing users to choose the right tool for the
|
|
||||||
job.
|
|
||||||
|
|
||||||
|
|
||||||
What's a good use-case for Akka?
|
What's a good use-case for Akka?
|
||||||
|
|
|
||||||
|
|
@ -10,4 +10,5 @@ Utilities
|
||||||
../common/duration
|
../common/duration
|
||||||
../common/circuitbreaker
|
../common/circuitbreaker
|
||||||
extending-akka
|
extending-akka
|
||||||
microkernel
|
../intro/deployment-scenarios
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
|
|
||||||
.. _microkernel-java:
|
|
||||||
|
|
||||||
Microkernel
|
|
||||||
==================
|
|
||||||
|
|
||||||
The purpose of the Akka Microkernel is to offer a bundling mechanism so that you can distribute
|
|
||||||
an Akka application as a single payload, without the need to run in a Java Application Server or manually
|
|
||||||
having to create a launcher script.
|
|
||||||
|
|
||||||
The Akka Microkernel is included in the Akka download found at `downloads`_.
|
|
||||||
|
|
||||||
.. _downloads: http://akka.io/downloads
|
|
||||||
|
|
||||||
To run an application with the microkernel you need to create a Bootable class
|
|
||||||
that handles the startup and shutdown the application. An example is included below.
|
|
||||||
|
|
||||||
Put your application jar in the ``deploy`` directory and additional dependencies in the ``lib`` directory
|
|
||||||
to have them automatically loaded and placed on the classpath.
|
|
||||||
|
|
||||||
To start the kernel use the scripts in the ``bin`` directory, passing the boot
|
|
||||||
classes for your application.
|
|
||||||
|
|
||||||
The start script adds ``config`` directory first in the classpath, followed by ``lib/*``.
|
|
||||||
It runs java with main class ``akka.kernel.Main`` and the supplied Bootable class as
|
|
||||||
argument.
|
|
||||||
|
|
||||||
Example command (on a unix-based system):
|
|
||||||
|
|
||||||
.. code-block:: none
|
|
||||||
|
|
||||||
bin/akka sample.kernel.hello.HelloKernel
|
|
||||||
|
|
||||||
Use ``Ctrl-C`` to interrupt and exit the microkernel.
|
|
||||||
|
|
||||||
On a Windows machine you can also use the bin/akka.bat script.
|
|
||||||
|
|
||||||
The code for the Hello Kernel example (see the ``HelloKernel`` class for an example
|
|
||||||
of creating a Bootable):
|
|
||||||
|
|
||||||
.. includecode:: ../../../akka-samples/akka-sample-hello-kernel/src/main/java/sample/kernel/hello/java/HelloKernel.java
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -192,3 +192,13 @@ Router configuration entries have also changed for the module, they use prefix `
|
||||||
``cluster-metrics-adaptive-pool`` and ``cluster-metrics-adaptive-group``
|
``cluster-metrics-adaptive-pool`` and ``cluster-metrics-adaptive-group``
|
||||||
Metrics extension classes and objects are located in the new package ``akka.cluster.metrics``.
|
Metrics extension classes and objects are located in the new package ``akka.cluster.metrics``.
|
||||||
Please see :ref:`Scala <cluster-metrics-scala>`, :ref:`Java <cluster-metrics-java>` for more information.
|
Please see :ref:`Scala <cluster-metrics-scala>`, :ref:`Java <cluster-metrics-java>` for more information.
|
||||||
|
|
||||||
|
Microkernel is Deprecated
|
||||||
|
=========================
|
||||||
|
|
||||||
|
Akka Microkernel is deprecated and will be removed. It is replaced by using an ordinary
|
||||||
|
user defined main class and packaging with `sbt-native-packager <https://github.com/sbt/sbt-native-packager>`_
|
||||||
|
or `Typesafe ConductR <http://typesafe.com/products/conductr>`_.
|
||||||
|
Please see :ref:`deployment-scenarios` for more information.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,4 +10,5 @@ Utilities
|
||||||
../common/duration
|
../common/duration
|
||||||
../common/circuitbreaker
|
../common/circuitbreaker
|
||||||
extending-akka
|
extending-akka
|
||||||
microkernel
|
../intro/deployment-scenarios
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
||||||
|
|
||||||
.. _microkernel-scala:
|
|
||||||
|
|
||||||
Microkernel
|
|
||||||
===================
|
|
||||||
|
|
||||||
The purpose of the Akka Microkernel is to offer a bundling mechanism so that you can distribute
|
|
||||||
an Akka application as a single payload, without the need to run in a Java Application Server or manually
|
|
||||||
having to create a launcher script.
|
|
||||||
|
|
||||||
The Akka Microkernel is included in the Akka download found at `downloads`_.
|
|
||||||
|
|
||||||
.. _downloads: http://akka.io/downloads
|
|
||||||
|
|
||||||
To run an application with the microkernel you need to create a Bootable class
|
|
||||||
that handles the startup and shutdown the application.
|
|
||||||
|
|
||||||
The code for the Hello Kernel example (see the ``HelloKernel`` class for an example
|
|
||||||
of creating a Bootable):
|
|
||||||
|
|
||||||
.. includecode:: ../../../akka-samples/akka-sample-hello-kernel/src/main/scala/sample/kernel/hello/HelloKernel.scala
|
|
||||||
|
|
||||||
|
|
||||||
Add `sbt-native-packager <https://github.com/sbt/sbt-native-packager>`_ to the plugins.sbt
|
|
||||||
|
|
||||||
.. code-block:: none
|
|
||||||
|
|
||||||
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.8.0-M2")
|
|
||||||
|
|
||||||
Use the package settings for ``akka_application``, and specify the mainClass in build.sbt
|
|
||||||
|
|
||||||
.. includecode:: ../../../akka-samples/akka-sample-hello-kernel/build.sbt
|
|
||||||
|
|
||||||
|
|
||||||
Use sbt task ``stage`` to generate the start script. Also you can use task ``universal:packageZipTarball`` to package the application.
|
|
||||||
|
|
||||||
To start the application (on a unix-based system):
|
|
||||||
|
|
||||||
.. code-block:: none
|
|
||||||
|
|
||||||
./target/universal/stage/bin/hello-kernel
|
|
||||||
|
|
||||||
Use ``Ctrl-C`` to interrupt and exit the microkernel.
|
|
||||||
|
|
||||||
On a Windows machine you can also use the ``target\universal\stage\bin\hello-kernel.bat`` script.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -42,6 +42,7 @@ import scala.collection.JavaConverters._
|
||||||
* bin/akka org.app.BootApp
|
* bin/akka org.app.BootApp
|
||||||
* }}}
|
* }}}
|
||||||
*/
|
*/
|
||||||
|
@deprecated("Microkernel is deprecated. Use ordinary main class instead", "2.4")
|
||||||
trait Bootable {
|
trait Bootable {
|
||||||
/**
|
/**
|
||||||
* Callback run on microkernel startup.
|
* Callback run on microkernel startup.
|
||||||
|
|
@ -59,6 +60,7 @@ trait Bootable {
|
||||||
/**
|
/**
|
||||||
* Main class for running the microkernel.
|
* Main class for running the microkernel.
|
||||||
*/
|
*/
|
||||||
|
@deprecated("Microkernel is deprecated. Use ordinary main class instead.", "2.4")
|
||||||
object Main {
|
object Main {
|
||||||
private val quiet = getBoolean("akka.kernel.quiet")
|
private val quiet = getBoolean("akka.kernel.quiet")
|
||||||
|
|
||||||
|
|
@ -181,6 +183,7 @@ object Main {
|
||||||
NNNNNNDDNNNNNNNN NNNNN =NNNNN $NNNN+ DNNNN? DNNNNNNDNNNNNNNND
|
NNNNNNDDNNNNNNNN NNNNN =NNNNN $NNNN+ DNNNN? DNNNNNNDNNNNNNNND
|
||||||
NNNNNNNNN NNNN$ NNNNN 8NNNND $NNNN+ NNNNN= ,DNNNNNNND NNNNN$
|
NNNNNNNNN NNNN$ NNNNN 8NNNND $NNNN+ NNNNN= ,DNNNNNNND NNNNN$
|
||||||
|
|
||||||
|
Microkernel is deprecated. Use ordinary main class instead.
|
||||||
==============================================================================
|
==============================================================================
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,121 +0,0 @@
|
||||||
Creative Commons Legal Code
|
|
||||||
|
|
||||||
CC0 1.0 Universal
|
|
||||||
|
|
||||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
|
||||||
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
|
||||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
|
||||||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
|
||||||
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
|
||||||
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
|
||||||
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
|
||||||
HEREUNDER.
|
|
||||||
|
|
||||||
Statement of Purpose
|
|
||||||
|
|
||||||
The laws of most jurisdictions throughout the world automatically confer
|
|
||||||
exclusive Copyright and Related Rights (defined below) upon the creator
|
|
||||||
and subsequent owner(s) (each and all, an "owner") of an original work of
|
|
||||||
authorship and/or a database (each, a "Work").
|
|
||||||
|
|
||||||
Certain owners wish to permanently relinquish those rights to a Work for
|
|
||||||
the purpose of contributing to a commons of creative, cultural and
|
|
||||||
scientific works ("Commons") that the public can reliably and without fear
|
|
||||||
of later claims of infringement build upon, modify, incorporate in other
|
|
||||||
works, reuse and redistribute as freely as possible in any form whatsoever
|
|
||||||
and for any purposes, including without limitation commercial purposes.
|
|
||||||
These owners may contribute to the Commons to promote the ideal of a free
|
|
||||||
culture and the further production of creative, cultural and scientific
|
|
||||||
works, or to gain reputation or greater distribution for their Work in
|
|
||||||
part through the use and efforts of others.
|
|
||||||
|
|
||||||
For these and/or other purposes and motivations, and without any
|
|
||||||
expectation of additional consideration or compensation, the person
|
|
||||||
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
|
||||||
is an owner of Copyright and Related Rights in the Work, voluntarily
|
|
||||||
elects to apply CC0 to the Work and publicly distribute the Work under its
|
|
||||||
terms, with knowledge of his or her Copyright and Related Rights in the
|
|
||||||
Work and the meaning and intended legal effect of CC0 on those rights.
|
|
||||||
|
|
||||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
|
||||||
protected by copyright and related or neighboring rights ("Copyright and
|
|
||||||
Related Rights"). Copyright and Related Rights include, but are not
|
|
||||||
limited to, the following:
|
|
||||||
|
|
||||||
i. the right to reproduce, adapt, distribute, perform, display,
|
|
||||||
communicate, and translate a Work;
|
|
||||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
|
||||||
iii. publicity and privacy rights pertaining to a person's image or
|
|
||||||
likeness depicted in a Work;
|
|
||||||
iv. rights protecting against unfair competition in regards to a Work,
|
|
||||||
subject to the limitations in paragraph 4(a), below;
|
|
||||||
v. rights protecting the extraction, dissemination, use and reuse of data
|
|
||||||
in a Work;
|
|
||||||
vi. database rights (such as those arising under Directive 96/9/EC of the
|
|
||||||
European Parliament and of the Council of 11 March 1996 on the legal
|
|
||||||
protection of databases, and under any national implementation
|
|
||||||
thereof, including any amended or successor version of such
|
|
||||||
directive); and
|
|
||||||
vii. other similar, equivalent or corresponding rights throughout the
|
|
||||||
world based on applicable law or treaty, and any national
|
|
||||||
implementations thereof.
|
|
||||||
|
|
||||||
2. Waiver. To the greatest extent permitted by, but not in contravention
|
|
||||||
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
|
||||||
irrevocably and unconditionally waives, abandons, and surrenders all of
|
|
||||||
Affirmer's Copyright and Related Rights and associated claims and causes
|
|
||||||
of action, whether now known or unknown (including existing as well as
|
|
||||||
future claims and causes of action), in the Work (i) in all territories
|
|
||||||
worldwide, (ii) for the maximum duration provided by applicable law or
|
|
||||||
treaty (including future time extensions), (iii) in any current or future
|
|
||||||
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
|
||||||
including without limitation commercial, advertising or promotional
|
|
||||||
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
|
||||||
member of the public at large and to the detriment of Affirmer's heirs and
|
|
||||||
successors, fully intending that such Waiver shall not be subject to
|
|
||||||
revocation, rescission, cancellation, termination, or any other legal or
|
|
||||||
equitable action to disrupt the quiet enjoyment of the Work by the public
|
|
||||||
as contemplated by Affirmer's express Statement of Purpose.
|
|
||||||
|
|
||||||
3. Public License Fallback. Should any part of the Waiver for any reason
|
|
||||||
be judged legally invalid or ineffective under applicable law, then the
|
|
||||||
Waiver shall be preserved to the maximum extent permitted taking into
|
|
||||||
account Affirmer's express Statement of Purpose. In addition, to the
|
|
||||||
extent the Waiver is so judged Affirmer hereby grants to each affected
|
|
||||||
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
|
||||||
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
|
||||||
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
|
||||||
maximum duration provided by applicable law or treaty (including future
|
|
||||||
time extensions), (iii) in any current or future medium and for any number
|
|
||||||
of copies, and (iv) for any purpose whatsoever, including without
|
|
||||||
limitation commercial, advertising or promotional purposes (the
|
|
||||||
"License"). The License shall be deemed effective as of the date CC0 was
|
|
||||||
applied by Affirmer to the Work. Should any part of the License for any
|
|
||||||
reason be judged legally invalid or ineffective under applicable law, such
|
|
||||||
partial invalidity or ineffectiveness shall not invalidate the remainder
|
|
||||||
of the License, and in such case Affirmer hereby affirms that he or she
|
|
||||||
will not (i) exercise any of his or her remaining Copyright and Related
|
|
||||||
Rights in the Work or (ii) assert any associated claims and causes of
|
|
||||||
action with respect to the Work, in either case contrary to Affirmer's
|
|
||||||
express Statement of Purpose.
|
|
||||||
|
|
||||||
4. Limitations and Disclaimers.
|
|
||||||
|
|
||||||
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
|
||||||
surrendered, licensed or otherwise affected by this document.
|
|
||||||
b. Affirmer offers the Work as-is and makes no representations or
|
|
||||||
warranties of any kind concerning the Work, express, implied,
|
|
||||||
statutory or otherwise, including without limitation warranties of
|
|
||||||
title, merchantability, fitness for a particular purpose, non
|
|
||||||
infringement, or the absence of latent or other defects, accuracy, or
|
|
||||||
the present or absence of errors, whether or not discoverable, all to
|
|
||||||
the greatest extent permissible under applicable law.
|
|
||||||
c. Affirmer disclaims responsibility for clearing rights of other persons
|
|
||||||
that may apply to the Work or any use thereof, including without
|
|
||||||
limitation any person's Copyright and Related Rights in the Work.
|
|
||||||
Further, Affirmer disclaims responsibility for obtaining any necessary
|
|
||||||
consents, permissions or other rights required for any use of the
|
|
||||||
Work.
|
|
||||||
d. Affirmer understands and acknowledges that Creative Commons is not a
|
|
||||||
party to this document and has no duty or obligation with respect to
|
|
||||||
this CC0 or use of the Work.
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
Akka Sample by Typesafe
|
|
||||||
|
|
||||||
Licensed under Public Domain (CC0)
|
|
||||||
|
|
||||||
To the extent possible under law, the person who associated CC0 with
|
|
||||||
this Akka Sample has waived all copyright and related or neighboring
|
|
||||||
rights to this Akka Sample.
|
|
||||||
|
|
||||||
You should have received a copy of the CC0 legalcode along with this
|
|
||||||
work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
Hello World Sample
|
|
||||||
==================
|
|
||||||
|
|
||||||
This sample is meant to be used by studying the code; it does not perform any
|
|
||||||
astounding functions when running it. If you want to run it, check out the akka
|
|
||||||
sources on your local hard drive, follow the [instructions for setting up Akka
|
|
||||||
with SBT](http://doc.akka.io/docs/akka/current/intro/getting-started.html).
|
|
||||||
When you start SBT within the checked-out akka source directory, you can run
|
|
||||||
this sample by typing
|
|
||||||
|
|
||||||
akka-sample-hello/run
|
|
||||||
|
|
||||||
You can read more in the [Akka docs](http://akka.io/docs).
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
import NativePackagerKeys._
|
|
||||||
|
|
||||||
packageArchetype.akka_application
|
|
||||||
|
|
||||||
name := "hello-kernel"
|
|
||||||
|
|
||||||
version := "2.4-SNAPSHOT"
|
|
||||||
|
|
||||||
scalaVersion := "2.11.5"
|
|
||||||
|
|
||||||
mainClass in Compile := Some("sample.kernel.hello.HelloKernel")
|
|
||||||
|
|
||||||
libraryDependencies ++= Seq(
|
|
||||||
"com.typesafe.akka" %% "akka-kernel" % "2.4-SNAPSHOT",
|
|
||||||
"com.typesafe.akka" %% "akka-actor" % "2.4-SNAPSHOT"
|
|
||||||
)
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
sbt.version=0.13.7
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.8.0-M2")
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
package sample.kernel.hello.java;
|
|
||||||
|
|
||||||
import akka.actor.ActorRef;
|
|
||||||
import akka.actor.UntypedActor;
|
|
||||||
import akka.actor.ActorSystem;
|
|
||||||
import akka.actor.Props;
|
|
||||||
import akka.kernel.Bootable;
|
|
||||||
|
|
||||||
public class HelloKernel implements Bootable {
|
|
||||||
final ActorSystem system = ActorSystem.create("hellokernel");
|
|
||||||
|
|
||||||
public static class HelloActor extends UntypedActor {
|
|
||||||
final ActorRef worldActor = getContext().actorOf(
|
|
||||||
Props.create(WorldActor.class));
|
|
||||||
|
|
||||||
public void onReceive(Object message) {
|
|
||||||
if (message == "start")
|
|
||||||
worldActor.tell("Hello", getSelf());
|
|
||||||
else if (message instanceof String)
|
|
||||||
System.out.println(String.format("Received message '%s'", message));
|
|
||||||
else
|
|
||||||
unhandled(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class WorldActor extends UntypedActor {
|
|
||||||
public void onReceive(Object message) {
|
|
||||||
if (message instanceof String)
|
|
||||||
getSender().tell(((String) message).toUpperCase() + " world!",
|
|
||||||
getSelf());
|
|
||||||
else
|
|
||||||
unhandled(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void startup() {
|
|
||||||
system.actorOf(Props.create(HelloActor.class)).tell("start", null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void shutdown() {
|
|
||||||
system.terminate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
package sample.kernel.hello
|
|
||||||
|
|
||||||
import akka.actor.{ Actor, ActorSystem, Props }
|
|
||||||
import akka.kernel.Bootable
|
|
||||||
|
|
||||||
case object Start
|
|
||||||
|
|
||||||
class HelloActor extends Actor {
|
|
||||||
val worldActor = context.actorOf(Props[WorldActor])
|
|
||||||
|
|
||||||
def receive = {
|
|
||||||
case Start => worldActor ! "Hello"
|
|
||||||
case message: String =>
|
|
||||||
println("Received message '%s'" format message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class WorldActor extends Actor {
|
|
||||||
def receive = {
|
|
||||||
case message: String => sender() ! (message.toUpperCase + " world!")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class HelloKernel extends Bootable {
|
|
||||||
val system = ActorSystem("hellokernel")
|
|
||||||
|
|
||||||
def startup = {
|
|
||||||
system.actorOf(Props[HelloActor]) ! Start
|
|
||||||
}
|
|
||||||
|
|
||||||
def shutdown = {
|
|
||||||
system.terminate()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
import NativePackagerHelper._
|
||||||
|
|
||||||
name := "akka-sample-main-scala"
|
name := "akka-sample-main-scala"
|
||||||
|
|
||||||
version := "2.4-SNAPSHOT"
|
version := "2.4-SNAPSHOT"
|
||||||
|
|
@ -7,3 +9,20 @@ scalaVersion := "2.11.5"
|
||||||
libraryDependencies ++= Seq(
|
libraryDependencies ++= Seq(
|
||||||
"com.typesafe.akka" %% "akka-actor" % "2.4-SNAPSHOT"
|
"com.typesafe.akka" %% "akka-actor" % "2.4-SNAPSHOT"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
enablePlugins(JavaServerAppPackaging)
|
||||||
|
|
||||||
|
mainClass in Compile := Some("sample.hello.Main")
|
||||||
|
|
||||||
|
mappings in Universal ++= {
|
||||||
|
// optional example illustrating how to copy additional directory
|
||||||
|
directory("scripts") ++
|
||||||
|
// copy configuration files to config directory
|
||||||
|
contentOf("src/main/resources").toMap.mapValues("config/" + _)
|
||||||
|
}
|
||||||
|
|
||||||
|
// add 'config' directory first in the classpath of the start script,
|
||||||
|
// an alternative is to set the config file locations via CLI parameters
|
||||||
|
// when starting the application
|
||||||
|
scriptClasspath := Seq("../config/") ++ scriptClasspath.value
|
||||||
|
|
||||||
|
|
|
||||||
1
akka-samples/akka-sample-main-scala/project/plugins.sbt
Normal file
1
akka-samples/akka-sample-main-scala/project/plugins.sbt
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.0-RC1")
|
||||||
|
|
@ -189,7 +189,7 @@ object AkkaBuild extends Build {
|
||||||
// FIXME osgiDiningHakkersSampleMavenTest temporarily removed from aggregate due to #16703
|
// FIXME osgiDiningHakkersSampleMavenTest temporarily removed from aggregate due to #16703
|
||||||
aggregate = if (!CommandLineOptions.aggregateSamples) Nil else
|
aggregate = if (!CommandLineOptions.aggregateSamples) Nil else
|
||||||
Seq(sampleCamelJava, sampleCamelScala, sampleClusterJava, sampleClusterScala, sampleFsmScala,
|
Seq(sampleCamelJava, sampleCamelScala, sampleClusterJava, sampleClusterScala, sampleFsmScala,
|
||||||
sampleHelloKernel, sampleMainJava, sampleMainScala, sampleMultiNodeScala,
|
sampleMainJava, sampleMainScala, sampleMultiNodeScala,
|
||||||
samplePersistenceJava, samplePersistenceScala, sampleRemoteJava, sampleRemoteScala)
|
samplePersistenceJava, samplePersistenceScala, sampleRemoteJava, sampleRemoteScala)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -201,8 +201,6 @@ object AkkaBuild extends Build {
|
||||||
|
|
||||||
lazy val sampleFsmScala = Sample.project("akka-sample-fsm-scala")
|
lazy val sampleFsmScala = Sample.project("akka-sample-fsm-scala")
|
||||||
|
|
||||||
lazy val sampleHelloKernel = Sample.project("akka-sample-hello-kernel")
|
|
||||||
|
|
||||||
lazy val sampleMainJava = Sample.project("akka-sample-main-java")
|
lazy val sampleMainJava = Sample.project("akka-sample-main-java")
|
||||||
lazy val sampleMainScala = Sample.project("akka-sample-main-scala")
|
lazy val sampleMainScala = Sample.project("akka-sample-main-scala")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,3 +27,5 @@ addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.1.6")
|
||||||
|
|
||||||
// stats reporting
|
// stats reporting
|
||||||
libraryDependencies += "com.timgroup" % "java-statsd-client" % "2.0.0"
|
libraryDependencies += "com.timgroup" % "java-statsd-client" % "2.0.0"
|
||||||
|
|
||||||
|
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.0-RC1")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue