d-haven / dhaven.faux Goto Github PK
View Code? Open in Web Editor NEWDotnet version of the Netflix Feign library
License: Apache License 2.0
Dotnet version of the Netflix Feign library
License: Apache License 2.0
Is your feature request related to a problem? Please describe.
Add full support for dependency injection through NetCore DI with the IApplicationBuilder and IServiceProvider interfaces.
Describe the solution you'd like
This allows Faux to integrate with web services that call other web services.
Additional context
Still want to support not using DependencyInjection if the application doesn't need it.
The ResponseHeader is valid for return values and out parameters. NOTE: out parameters mean you cannot use async/await. This allows the consumer of the web service to receive the values that were defined in the response headers.
Add support for JSON serialization:
[FauxClient]
public interface IThingService
{
[HttpPost]
void AddNew([Body] Thing newThing);
}
and for direct streaming:
[FauxClient]
public interface IUploadService
{
[HttpPost]
void AddNew([Body] Stream content);
}
Describe the bug
In .net core 3.1 there are changes to ILoggerFactory configuration. But the package is not updated and still refers previous version .net core.
Method not found: 'Microsoft.Extensions.Logging.ILoggerFactory Microsoft.Extensions.Logging.DebugLoggerFactoryExtensions.AddDebug(Microsoft.Extensions.Logging.ILoggerFactory, Microsoft.Extensions.Logging.LogLevel)
I used this library in version. net 4.6.1 and found it unavailable. The AssemblyLoadContext method reported an error, hoping to support. net 4.6.
The chief issue here is the global HttpClient. We need to Abstract that out to an interface that HttpClient already implements.
Is your feature request related to a problem? Please describe.
The startup assumes that the interfaces need to be compiled every time, but there is the FauxGen command line tool to generate and compile those classes to an assembly. Nothing in the initialization will simply use them. We can save time if there isn't any compilation necessary.
Describe the solution you'd like
I'd like to have the AddFaux() extension method determine if there are implementations for the Faux interfaces, and use those directly.
Describe alternatives you've considered
Possible solutions include:
1、The regenerated code cannot be overwritten
2、Method has no return value ,but it can not use "Task" directly.
The command line utility will use reflection to scan an assembly to find all the [FauxClient] interfaces and generate an assembly from that.
This should function by providing the value that goes in the header as a parameter:
[FauxClient("uploadService")]
public interface IUploadService
{
[HttpPost]
void Upload([Body] Stream content, [RequestHeader("Content-Type")] contentType);
}
The value of the contentType
parameter is fed into the Content-Type
request header.
this project is wonderful;but i have some questions.
The most important thing at the moment is outputting the generated classes to the file system.
Technically, this feature could be useful for a code generation step so that everything's already compiled instead generating the assembly at runtime. Perhaps some attribution comments for the class.
Not sure whether it's my server or my client, but I am not sure the configuration is getting picked up.
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
As a type of user I want to do something so that I can the real problem you need to solve.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
We need to be able to handle a web service that sends and receives an object. Example:
[Route("api/[controller]")]
interface IFortuneController
{
[HttpGet("")]
Task<IEnumerable<Fortune>> ListFortunes();
[HttpPost("")]
Task<Fortune> CreateFortune(Fortune fortune);
[HttpGet("/{id}")]
Task<Fortune> Get(string id);
[HttpPut("/{id}")]
Task<Fortune> Update(string id, Fortune item);
}
how to send multipart/form-data type by DHaven.Faux
These will be added to the request parameters. Example:
[FauxClient("thingService")]
public interface IThingService
{
[HttpGet]
List<Thing> Get([RequestParameter] int page);
}
Calling the method Get(24)
would translate to http://thingService/?page=24
Give the user of the application the ability to override the default namespace for the generated code.
Acceptance Criteria:
Describe the solution you'd like
Add support for Hystrix (circuit breaker pattern) to improve reliability. The circuitbreaker support should have support for fail-over to provide a default value.
As a Micro Services Developer I want to automatically have support for Hystrix so that I can improve the reliability of the systems I am building.
Describe alternatives you've considered
Right now, Steeltoe's offering is the only one that supports the Hystrix monitoring from the NetFlix infrastructure projects. It's going to be more useful to be able to incorporate this into larger infrastructure.
The two real alternatives are:
I am leaning toward the second. but I can be persuaded.
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
As a type of user I want to do something so that I can the real problem you need to solve.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Is your feature request related to a problem? Please describe.
Faux uses the configuration API, but does not provide a nifty configuration class to properly integrate with NetCore configured objects. In short, let this be configured in the same way that NetCore Web API services are configured.
Describe the solution you'd like
As a programmer I want to override compiler settings so that I can influence the generated code to comply with my company's policies.
Describe alternatives you've considered
It can be done if I have a reference to the WebServiceCompiler I'm using to generate the services. However, it would be nice to configure this consistently like the applications I am going to use this in.
Create option for command line to control whether the generated classes are sealed or not. By default they should be.
I found that the incoming configuration was not used when generating the service, which led me to modify the eureka configuration with code without taking effect and without using the memory configuration.
So I recommend using the method ConfigureServices for the fauxcollection.cs file instead
Private static IServiceCollection ConfigureServices(IServiceCollection services, Type starterType)
{
Var config = FauxExtensions. Configuration;
If (config = = null)
{
Var builder = new ConfigurationBuilder()
SetBasePath (Directory. GetCurrentDirectory ())
AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
AddEnvironmentVariables ();
The config = builder. The Build ();
}
Services. AddLogging (logger = > logger. AddDebug () AddConfiguration (config));
Services. AddFaux (config, starterType);
Return services;
}
Then set the static variable public static IConfiguration Configuration in FauxExtensions.
I'm going to assign that to the AddFaux method
// the configured service collection
[SuppressMessage (" ReSharper ", "MemberCanBePrivate. Global")]
[SuppressMessage (" ReSharper ", "UnusedMethodReturnValue. Global")]
Public static IServiceCollection AddFaux(this IServiceCollection services, IConfiguration configuration,
Type starterType = null)
{
The Configuration = Configuration;
Return AddFaux (services, configuration, starterType? The Assembly?? The Assembly. GetEntryAssembly ());
}
Is your feature request related to a problem? Please describe.
It would be better to allow the faux generated implementations are included in the build of the project.
Describe the solution you'd like
FauxGen creates the generated classes and those get included in the compilation of the target assembly. Faux already handles finding the implementations and using them at runtime.
Describe alternatives you've considered
It's currently a command line tool only. Not as useful as an MSBuild task with targets like other projects. Should integrate similar to other MSBuild plugins.
Is your feature request related to a problem? Please describe.
Based on this article there are two main problems with a bog standard HttpClient class:
Describe the solution you'd like
Using HttpClientFactory enables the ability to use a local load-balancing capability, and manage the list of alternate servers without Eureka (i.e. local loadbalancing)
1st, thanks for making progress on this library. After leaving a Spring Cloud project I was pleased to find this library but it was in a state that was not useable at the time. The addition of Hystrix and other features has made the library viable for our project now.
I want to make sure I am not trying to add features that may already be worked on.
I need a way to "dynamically" configure the Host/base url of the client. Something like how Netflix/Ribbon does it using properties like such:
<service name>.faux.listOfServers=server1.com,server2.com
<comma seperated list>
<service name>.faux.discovery.enabled=false
< by default, discovery is enabled and will use a IDiscoveryClient and Eureka to discover host/port of the service>
If these fautures are not already in the works, I will see what I can do to add these capabilities
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.