HOCON | C # implementation of Lightbend 's HOCON | JSON Processing library
kandi X-RAY | HOCON Summary
kandi X-RAY | HOCON Summary
C# implementation of Typesafe's HOCON (Human-Optimized Object Configuration Notation).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of HOCON
HOCON Key Features
HOCON Examples and Code Snippets
Community Discussions
Trending Discussions on HOCON
QUESTION
Almost all Akka.net documentation refers to documentation through HOCON in some form. From my understanding, HOCON was made to tackle issues related to XML-based configuration in .NET Framework. Now that everything in JSON-based (starting in .NET Core), I would really want to configure Akka.net through appsettings.json, just like any other service I write in .NET. Some solutions I have found to this approach seem rather hacky by pasting a HOCON string in the appsettings file, or have the HOCON object inline in the source code. It would be very nice to have it within an appsettings since this fits better in how both my team manages configuration, deployment-wise, and modern .NET applications approach configuration.
Why is Akka.net using HOCON instead of a more abstract interface such as IConfiguration, and how can I best configure it by following best practices in .NET using appsettings.json and IConfiguration?
...ANSWER
Answered 2021-Oct-01 at 14:14I believe one of the reasons why Akka.net uses HOCON is due to how it is a 1-1 port of Akka (Java), which also heavily relies on HOCON for configuration. For portability it is then the preferred format for configuring the framework. While it is just speculation from my side, it could be a priority thing why there is no support for IConfiguration
since the current way of configuration "just works" even though it fits poorly together with how newer .NET applications are written today.
There are a few ways that the Akka.Configuration.Config
can be built from an IConfiguration
instance. One way is to take the IConfiguration
object, and construct a JSON string from it, then give it to ConfigurationFactory.ParseString
which does support parsing JSON. A HOCON representation can then be obtained from the parsed Config
instance. In order to correctly parse a JSON object, the generated HOCON string has to parsed again (my guess is because of a bug that makes it interpret JSON and HOCON differently). Make sure the JSON config does not contain any properties such as {"foo.don" : "bar"}
, while HOCON supports resolving foo.don
- JSON does not. Below is the extension method I put together for parsing a Config
from an IConfiguration
instance:
QUESTION
I am setting up a ktor api that connects with a postgres container in docker. I can get everything working when I hard code things. When I try to use the hocon config and print values I can see my dburl and dbuser but when I print my dbpassword I get an address like value.
Here is my hocon config:
...ANSWER
Answered 2021-Oct-01 at 08:21The problem is that the last call for getting value of db.dbPassword
is toString
instead of getString
.
QUESTION
I have this application using Akka.net cluster feature. The people who wrote the code have left the company. I am trying to understand the code and we are planning a deployment.
The cluster has 2 types of nodes
QueueServicer: supports sharding and only these nodes should participate in sharding.
LightHouse: They are just seed nodes, nothing else.
Lighthouse : 2 nodes
QueueServicer : 3 Nodes
I see one of the QueueServicer node unable to join the cluster. Both lighthouse nodes are refusing connection. It constantly tries to join and never succeeds. This has been happening for the last 5 days or so and the node is never dying also. Its CPU and memory usage is high. Also It doesn't have any queue processor actors running when filtered search through the log. It takes long hours for Garbage collection etc. I see in the log for this node, the following.
{"timestamp":"2021-09-08T22:26:59.025Z", "logger":"Akka.Event.DummyClassForStringSources", "message":Tried to associate with unreachable remote address [akka.tcp://myapp@lighthouse-1:7892]. Address is now gated for 5000 ms, all messages to this address will be delivered to dead letters. Reason: [Association failed with akka.tcp://myapp@lighthouse-1:7892] Caused by: [System.AggregateException: One or more errors occurred. (Connection refused akka.tcp://myapp@lighthouse-1:7892) ---> Akka.Remote.Transport.InvalidAssociationException: Connection refused akka.tcp://myapp@lighthouse-1:7892 at Akka.Remote.Transport.DotNetty.TcpTransport.AssociateInternal(Address remoteAddress) at Akka.Remote.Transport.DotNetty.DotNettyTransport.Associate(Address remoteAddress) --- End of inner exception stack trace --- at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at Akka.Remote.Transport.ProtocolStateActor.<>c.b__12_18(Task
1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
{"timestamp":"2021-09-08T22:26:59.025Z", "logger":"Akka.Event.DummyClassForStringSources", "message":Tried to associate with unreachable remote address [akka.tcp://myapp@lighthouse-0:7892]. Address is now gated for 5000 ms, all messages to this address will be delivered to dead letters. Reason: [Association failed with akka.tcp://myapp@lighthouse-0:7892] Caused by: [System.AggregateException: One or more errors occurred. (Connection refused akka.tcp://myapp@lighthouse-0:7892) ---> Akka.Remote.Transport.InvalidAssociationException: Connection refused akka.tcp://myapp@lighthouse-0:7892 at Akka.Remote.Transport.DotNetty.TcpTransport.AssociateInternal(Address remoteAddress) at Akka.Remote.Transport.DotNetty.DotNettyTransport.Associate(Address remoteAddress) --- End of inner exception stack trace --- at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at Akka.Remote.Transport.ProtocolStateActor.<>c.b__12_18(Task
1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
There are other "Now supervising", "Stopping" "Started" logs which I am omitting here.
Can you please verify if the HCON config is correct for split brain resolver and Sharding?
I think LightHouse/SeeNodes should not have the sharding configuration specified. I think it is a mistake. I also think, split brain resolver configuration might be wrong in LightHouse/SeedNodes and should not be specified for seed nodes.
I appreciate your help.
Here is the HOCON for QueueServicer Trimmed
akka {
loggers = ["Akka.Logger.log4net.Log4NetLogger, Akka.Logger.log4net"]
log-config-on-start = on
loglevel = "DEBUG"
actor {
provider = cluster
serializers {
hyperion = "Akka.Serialization.HyperionSerializer, Akka.Serialization.Hyperion"
}
serialization-bindings {
"System.Object" = hyperion
}
}
ANSWER
Answered 2021-Sep-17 at 16:36I meant to reply to this sooner.
Here is your problem: you're using two different split brain resolver configurations - one for the QueueServicer and one for Lighthouse. Therefore, how your cluster resolves itself is going to be quite different depending upon who is the leader of each half of the cluster.
I would stick with a simple keep-majority strategy and use it uniformly on all nodes throughout the cluster - we're very likely going to enable this by default in Akka.NET v1.5.
If you have any questions, please feel free to reach out to us: https://petabridge.com/
QUESTION
I have defined the values.yaml
like the following:
ANSWER
Answered 2021-May-08 at 13:34I was able to resolve the issue. The issue was using configmap
in place configMap
in deployment.yaml
:
QUESTION
Currently I'm using the akka.net lighthouse docker image which is on dockerhub. Together with Akka.Bootstrap.Docker it's nice to override akka hocon configuration from the environment variables. I've set the following environment variables in my k8s deployment file
...ANSWER
Answered 2021-Mar-09 at 17:36Akka.NET is trying to load hyperion serializer via Type.GetType("Akka.Serialization.HyperionSerializer, Akka.Serialization.Hyperion")
call, and fails to do that, because Lighthouse docker image does not include Akka.Serialization.Hyperion package.
So what you need to do is:
- Clone Lighthouse repo and add Akka.Serialization.Hyperion package to Lighthouse project references
- Build your own docker image and use it instead.
QUESTION
I'm new to rust and want to understand how to load config from file to use it in code.
In main.rs and other files i want to use config loaded from file:
...ANSWER
Answered 2021-Feb-07 at 17:58QUESTION
I have a case class like the following:
...ANSWER
Answered 2021-Jan-12 at 15:49As @LuisMiguelMejíaSuárez suggested in the comment, you should add a default argument:
QUESTION
Using Ktor as a web server and configuring it with the (HOCON) application.conf file.
I've setup a default password for connecting to a database in the configuration, as well as the ability for it to be overridden with an environment variable.
When the server starts, the configurations is printed to the console (and probably in future stored in logs), the problem is that the password is plainly visible.
Does anyone know of a way to prevent this?
Representative application.conf:
...ANSWER
Answered 2020-Dec-10 at 13:18You can put your parameters with sensitive values inside the security
section to make them hidden inside logs. Here is an example:
QUESTION
I am trying to setup a custom @ConfigurationProperties
class loaded from a HOCON syntax .conf
file.
I have a Class annotated with @PropertySource(factory=TypesafePropertySourceFactory.class, value = "classpath:app.conf")
ANSWER
Answered 2020-Sep-25 at 08:58Maybe you can also solve it with the use of a ContextInitializer as suggested in the answer here:
QUESTION
I have following HOCON config:
...ANSWER
Answered 2020-Sep-20 at 14:05You can do the same without using recursion. Use method entrySet
as following
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install HOCON
If you need access to nightly HOCON builds, you can get them via the Akka.NET nightly build NuGet feed.
To install Microsoft.Extensions.Configuration via NuGet:.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page