Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp code generator #36

Closed
michaelklishin opened this issue Mar 1, 2015 · 3 comments
Closed

Revamp code generator #36

michaelklishin opened this issue Mar 1, 2015 · 3 comments
Labels
effort-medium next-gen-todo If a rewrite happens, address this issue.

Comments

@michaelklishin
Copy link
Member

We've been avoiding tweaking code generator much in recent years because it's fairly hard to make non-trivial changes. As a result it is much harder to refactor the rest of the library because we depend on the existing ModelBase hierarchy and responsibility scope heavily.

Now that we require .NET 4.0, we can investigate Expression Trees. The idea of using F# has came up a few times in the past (for templating, implementing ModelBase in F# and relying e.g. on Code Quotations will likely suffer from the law of diminishing returns in our case).

Specific points of improvements we should aim for:

Since the code generation artefacts are not exposed to end users, we can make breaking changes there but preserving .NET and Mono compatibility is a must.

@YulerB
Copy link
Contributor

YulerB commented Oct 18, 2017

Is the idea to use T4?

@YulerB
Copy link
Contributor

YulerB commented Oct 20, 2017

Or something like this:

client
/* Expressions built from here. */
  
	.ConfigureHosts(Expression<Func<IEnumerable<EndPoint>> host)

	.GetCluster(Expression<Func<string>> host)
	.GetLocalEndpoint()
	.GetNearestClusterEndpoint()

	.Heartbeat(Expression<Func<int>> frequency)
	.VirtualHost(Expression<Func<string>> vHost)
	
	.AuthenticatePlain(Expression<Func<NetworkCredential>> cred)
	.AuthenticateCertificate(Expression<Func<X509Certificate2>> cert)			
	
	.FailoverAutomaticly() /*Default to not fail-over automatically */
	.RecoverTopology() /*Default to not recover the topology*/

	.DirectExchange(Expression<Func<string>> exchange)
	.FanoutExchange(Expression<Func<string>> exchange)
	
	.AutoDeleteQueue(Expression<Func<string>> queue)
	.DurableQueue(Expression<Func<string>> queue)
	
	.SetDeadLetter(Expression<Func<string>> exchange, Expression<Func<string>> queue)

	.SetMessageQualityOfService(Expression<Func<int>> messages)
	.SetMessageSizeQualityOfService(Expression<Func<int>> bytes)
	
/* execution occurs on these methods. */

	.Publish(SendMessage message)
	.BatchPublish(IEnumerable<SendMessage> messages)
	.PublishWithConfirm(SendMessage message)
	.BatchPublishWithConfirm(IEnumerable<SendMessage> messages)

	.GetStatistics()
	.GetMessage()
	.PurgeQueue()
	.DeleteQueue()
	.ForwardTo(string exchange, string queue)

	.ConsumeAsync(Func<Task, ReceivedMessage> consumer)
	.Consume(Action<ReceivedMessage> consumer);

connection
	.ConnectTo(Expression<Func<EndPoint>> host)
	.SetLittleEndian()
	.SetBigEndian()
	.UseSSL(Expression<Func<X509Certificate2>> cert)

	.ConsumeAsync(Func<Task, Frame> consumer)
	.Consume(Action<Frame> consumer)
	.HandleFramesAsync()
	.HandleFrames()

@lukebakken lukebakken added the next-gen-todo If a rewrite happens, address this issue. label Jan 30, 2020
@lukebakken
Copy link
Contributor

Labeled for net-gen client and closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort-medium next-gen-todo If a rewrite happens, address this issue.
Projects
None yet
Development

No branches or pull requests

3 participants