Issue in LightInject when getting service instance - inversion-of-control

I have integrated Light Inject in web api project. I am able to register service successfully in application_start in global.asax. I am using filter which needs to be registered as well in application_start in global.asax. Filter constructor have reference to the services registered however I am not able to get the service instance. Samplee code:
service registration is as below:
container.Register<ILogger, EPPSLogger>(GetLifetime());
filter registration needs instance of ILogger. Using below code:
config.Filters.Add(new EPPSAuthenticationFilter(
config.DependencyResolver.GetService<ILogger>(),
config.DependencyResolver.GetService<IAuthenticationSecrets>()));
gets the error when try to getService that lightinject module is not injected/registered. I cant upgrade to .net framework 4.5 or so.
Any help is highly appreciated.
Thanks

Related

Create Service broker for Play Framework Api

I have created a sample play framework api which has one endpoint.
http://play-demo-broker.cfapps.io/say?number=20
Which just return me number that have passed.
I am able successfully deploy the service. Next want this service to Act like service broker
For same want to register this as by using below command
cf create-service-broker play-demo-broker admin admin http://play-demo-broker.cfapps.io --space-scoped
This command it giving me below error -
The service broker rejected the request. Status Code: 404 Not Found
Not sure what is causing this issue as there not much information available for Play Framework Service broker Setup.
The play framework is implemented above the akka packages. Akka rejects paths that are not implemented.
If I an not mistaken, cf create-service-broker command access the / endpoint. If you implemented only say?number=20 endpoint, then be default all other paths, such as the empty path, are rejected by Akka.
In order to open that endpoint you need to add it into the routes.
For example you can add:
GET / controllers.ControllerName.GetEmptyPath
And implement the GetEmptyPath method in ControllerName

RestTemplate annotated by #LoadBalanced get wrong service address by service name from eureka sometimes

I use springcloud to build the system, including many microservices。 For some interface calls, I use resttemplate annotated by #LoadBalance to implement load balancing, and use eureka as a registry center. However, when I call interfaces between different micro services, resttemplate sometimes will connect to wrong service. For example, I have service A, B, C, when service A call a service B's interface, resttemplate annotated by #LoadBalance will find the actual ip&port from eureka by service name first, and then build the actual url and send the request to target server, but sometimes, it will find the service C's ip&port when I call service B's interface, which cause a fail invoking. This case occurs infrequently but nerver disappear, I have been troubled for a long time, could anyone give me some suggestions? Thanks.
I learned why yesterday: it is a bug in spring cloud Dalston.RELEASE(https://github.com/spring-cloud/spring-cloud-commons/issues/224), and we happen to use this version. Spring cloud had fixed this bug in Dalston.SR2, and now it works fine

Detecting Service Fabric upgrade is completed using .NET client

Upgrading an existing SF application using .NET client with FabricClient.ApplicationManagementClient.UpgradeApplicationAsync and getting the status of upgrade using FabricClient.ApplicationManagementClient.GetApplicationUpgradeProgressAsync. Last command returns ApplicationUpgradeProgress with a property UpgradeStatus. I was hoping this enum (ApplicationUpgradeState) based property would have a value of Completed or something similar, but there's nothing like that.
What is the right way to determine (using .NET client) that a given SF application has successfully completed? Is there a callback option?
ApplicationUpgradeState.RollingForwardCompleted

Azure Mobile Services - logging when seeding the database

I want to log messages in the code I have in the Configuration.Seed() method.
But the log instance is in the ApiServices instance and I don't know how to access it from the Configuration class.
The ApiServices log property is just a thin wrapper around the Web API trace logger. You can get at it like this as well using the HttpConfiguration instance which you can pass into your database initializer:
config.Services.GetTraceWriter().Info("log something", category:"Initialization");
Hope this helps,
Henrik

jbpm 6.0.1 create process calling rest

How to create process with 1 service task - rest which calls
http://www.webservicex.net/currencyconvertor.asmx/ConversionRate?FromCurrency=EUR&ToCurrency=USD
and sets this value as parameter which can be seen later, using jbpm console(kie workbench)? JBOSS docs are mostly for user tasks.
My recommended solution is to create a new WorkItemHandler implementation that calls the web service get the results and inject that as a process variable.
You can see a similar example that calls web services here: https://github.com/droolsjbpm/jbpm-playground/tree/master/customer-relationships-workitems
HTH
There is a REST service task that you can use, available out-of-the-box in the web-based designer (under service tasks, so implemented as a custom service task). The associated handler should also be registered automatically when using the jbpm-installer:
https://github.com/droolsjbpm/jbpm/blob/master/jbpm-installer/conf/META-INF/CustomWorkItemHandlers.conf#L4