Giter VIP home page Giter VIP logo

dhaven.faux's People

Contributors

bloritsch avatar gitter-badger avatar honorduan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dhaven.faux's Issues

Implement Dependency Injection support better.

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.

Add support for ResponseHeader attribute

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 the BodyAttribute

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);
}

Not compatible with .Net Core 3.1 or greater

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)

Make DHaven.Faux easier to test.

The chief issue here is the global HttpClient. We need to Abstract that out to an interface that HttpClient already implements.

Add support to detect if Faux objects are already loaded and compilation is not necessary

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:

  • A manifest file that has a list of interfaces mapped to their implementations. That gets loaded at initialization time and we can simply register the class names instead of registering the interface to compile.
  • An internal attribute provided to all implementations and we scan for them.

Add support for the RequestHeaderAttribute

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.

Whether hystrix will be supported?

this project is wonderful;but i have some questions.

  1. steeltoe add a new feature circuitbreker .is it in your roadmap?
  2. like the asp.net routing mechanism. do you consider to use the service name and the method name as the default config to general the url ?
  3. do you consider to use dynamic proxy to implement your design.

Add debug configuration

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.

非常感谢,希望上传到nuget

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.

Dirt Road: Compile simple JSon exchange REST service

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);
}

Add support for the RequestParameterAttribute

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

Add option to set the namespace for generated code

Give the user of the application the ability to override the default namespace for the generated code.

Acceptance Criteria:

  • DHaven.Faux has an options object that can be provided to the compiler
  • That options object is used to create the namespace declaration
  • FauxGen has a command line option to set that attribute in the DHaven.Faux options object

Add support for Hystrix (Steeltoe.CircuitBreaker)

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:

  • Bake this in to the core project (DHaven.Faux)
  • Create a new project to extend the core (DHaven.Faux.CircuitBreaker)

I am leaning toward the second. but I can be persuaded.

Thanks,this will be used with my project.

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.

Make use of configuration pattern so that users can control how classes are created

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.

Sealed classes

Create option for command line to control whether the generated classes are sealed or not. By default they should be.

Euraka injection problem

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 ());
}

FauxGen should be an MSBuild integrated solution

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.

Modify to use HttpClientFactory

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:

  • If you instantiate it every time you need it, you will run into socket exhaustion. This library currently does not do this.
  • If you keep and use it as a singleton, you will never be resilient with DNS refreshes

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)

"Ribbon" support

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.