jonnii / chinchilla Goto Github PK
View Code? Open in Web Editor NEWMaking RabbitMq More Awesome!
License: Apache License 2.0
Making RabbitMq More Awesome!
License: Apache License 2.0
Hi Jon,
Is there way to implement message TTL to queue or per message? If for queue, is this done when creating topology builder.
Thanks,
Alan
I tried to test a publish/subscribe scenario with interface implementations and could not get it working.
I defined some message classes:
public interface IBaseMessage
{
int MsgId { get; set; }
}
public class OtherMessage : IBaseMessage
{
public int MsgId { get; set; }
public int DataI { get; set; }
}
public class OtherMessage2: IBaseMessage
{
public int MsgId { get; set; }
public float DataF { get; set; }
}
and then published the message:
using (var bus = Depot.Connect("localhost"))
{
while (running)
{
if (i % 2 == 0)
{
var pubMsg = new OtherMessage()
{
MsgId = i,
DataI = i*2
};
bus.Publish<IBaseMessage>(pubMsg);
}
else if (i % 2 == 1)
{
var pubMsg = new OtherMessage2()
{
MsgId = i,
DataF = i*3.0f
};
bus.Publish<IBaseMessage>(pubMsg);
}
i++;
Thread.Sleep(1000);
}
}
The subscriber looks like this, but no messages are received.
using (var bus = Depot.Connect("localhost"))
{
bus.Subscribe<IBaseMessage>(SubscriberCallback);
}
...
private static void SubscriberCallback3(IBaseMessage msg)
{
string rcvMsg = String.Empty;
if (msg is OtherMessage) {
rcvMsg = String.Format("id {0}, dataI = {1}", msg.MsgId, (msg as OtherMessage).DataI);
}
else if (msg is OtherMessage2)
{
rcvMsg = String.Format("id {0}, dataF = {1}", msg.MsgId, (msg as OtherMessage2).DataF);
}
System.Console.WriteLine(rcvMsg);
}
If I explicitly publish/subscribe the derived classes instead of the interface, the messages are received correctly.
Is there any possiblity to use an interface or base abstract class for messages?
Requires jonnii/SpeakEasy/issues/18
Hi Jonni,
Is there a way to check rabbitMQ connectivity. For example, if I create a IBus variable and successfully connect to RabbitMQ, few minutes later, the connectivity between client PC and RabbitMQ is disconnected, how I get knowledge that the connection has been disconnected?
Thank you,
Alan
The current Chinchilla nugget package contains the 3.1.x version of RabbitMQ.Client. There is a new version of RabbitMQ.Client (version 3.4). Is the current Chincilla support the new version of RabbitMQ.Client.
ISubscriptionBuilder.WithPrefetchCount
does not seem to have any effect.
For instance, after opening this subscription:
var subscription = _subscribingBus.Subscribe<RoutingKeyMessage<string>>(
OnMsgReceive,
b => b.WithPrefetchCount(1));
the queue still has the default prefetch count of 50.
I'll take a look and open a PR.
License.txt is empty
The current requester does not expose the ability to configure its topologies
public void Start()
{
subscription = bus.Subscribe<TResponse>(
DispatchToRegisteredResponseHandler,
b => b.SetTopology<DefaultRequestTopologyBuilder>()
.DeliverUsing<TaskDeliveryStrategy>());
var queue = subscription.Queues.First();
publisher = bus.CreatePublisher<TRequest>(p => p.ReplyTo(queue.Name));
}
@jonnii suggestions before I start hacking on this?
Hello,
I saw a feature within Chinchilla where one can connect to a cluster by settings up the ConnectionStrings in the DepoSettings. However, ConnectionStrings property does not exist in DepoSettings class. How do I connect to a cluster, at least to two RabbitMQ hosts?
This is the cluster feature --> https://github.com/jonnii/chinchilla/pull/41/files
Thank you,
Alan
Hello,
I saw this post below concerning Chinchilla connecting to two Rabbit hosts in cluster environment. However, when I setup the DepotSettings, i do not see the property to 'ConnectionStrings' as shown in the post from below URL. How can I setup the DepotSettings to supply two RMQ hosts as described in below post? Your help is greatly appreciated.
Hello Jonathan,
I have an application where multiple users using. I have one exchange (topic) and one queue. Each consumer connects to that one exchange and queue with unique binding for each consumer. I have this application that is a publisher it publishes message to that one exchange and queue. This application establishes one single IBUS which establish one connection. Each message publish, the application invokes the 'CreatePublisher' (IPublisher) and then invokes the 'Publish' method. My question is, should I only invoke 'CreatePublisher' once, maintain that throughout the life of the application and simply invoke Publish method each time to publish a message?
I appreciate your feedback.
Thanks,
Alan
The appveyor process still has some issues that need to be resolved.
Hello, is Chinchilla version compatible with RabbitMQ client version 3.4.4?
Hello,
Is it possible to implement the send/receive pattern with the available chinichilla bus interface ? We need this pattern for instance in a client/server scenario, where different clients send data to a well-known queue on a server application (several sender and one receiver).
Thanks in advance.
Sorry for me asking this but can you kindly provide example on how to create topology using fanout? The subscriber and consumer will use the fanout.
Thank you for your help.
If you're confirm a lot of messages there's room for improvement in the confirming publisher. Right now when ack/nacking multiple messages we iterate over all the keys of a concurrent dictionary, this is lazy and totally inappropriate. We should be using a min heap for this.
I've given this a bit of thought, and I think what we should do is something like this:
bus.CreatePublisher<TMessage>(o => o.PublishFaultStrategy<TFaultStrategy>());
We'll add a new interface called IPublishFaultStrategy
which will look something like this:
public interface IPublishFaultStrategy
{
IPublishFailAction ProcessFailedPublish<TMessage>(TMessage message);
}
public interface IPublishFailAction<TMessage>
{
void Process(IPublisher<TMessage> publisher, TMessage original);
}
What we might need to do is wrap a publishable message in a wrapper of some description, like I did with IDelivery
so that we can tack on things like retry-count etc... but we can do that later.
For the default publisher setting this will do nothing, we should probably throw an exception if they try to do this because they might expect it to work, but it won't unless the publisher is transactional (which we don't yet support) or has confirms enabled. In fact, it might be better to make this is an overload of IPublisherBuilder.Confirm
to make it less confusing.
For a confirming publisher there are a few weirdnesses. Firstly, when you get a nack it means that there was a message up to that message sequence number that failed, so it could be any of the receipts up to that number, which means we'll have to fail all of them. This could mean false positives? Users will have to ensure that all messages on the wire are idempotent.
Let me know what you think.
/cc @cocowalla
Does chinchilla support auto reconnect to another rabbitmq cluster node?
How to send custom headers when I publish a message? I can read headers in the subscriber, but cannot find out how to publish custom headers.
I have written a simple example with defect reproduction. Failure occurs when subscriber callback raises an exception. Eventually, Failed method of Chinchilla.Delivery in foreach class calls Accept method of Chinchilla.Delivery class, this call clears deliveryListeners collection. This causes "Collection was modified; enumeration operation may not execute" exception.
Update build scripts to support .NET 4.5 build, including:
wtf was i thinking.
Is there a way to handle an event or capture within Chinchilla should the RabbitMQ server is stopped or client lost connectivity?
Thanks,
Alan
When the RabbitMQ server is restarted and the client reconnects, it restarts issuing receipts from sequence 1.
This results in DuplicatePublishReceiptException
being thrown in Receipts<TMessage>.RegisterReceipt
, as the ConcurrentDictionary
will still contain unack'd receipts from the previous connection.
Acks/nacks are not sent when the broker restarts, so a simple solution is to clear out the receipts in the ConcurrentDictionary
when reconnecting, though this will leave the client not knowing whether the messages were sent or not, and with no way to do anything about it.
Or maybe we can make use of the IPublisherFailureStrategy for this?
What do you think?
The issue #31 raised a valid concern, which is that the delivery accept/reject stuff shouldn't be re-entrant, which it is because of the design of failures.
Failed messages shouldn't be responsible for clearing the delivery listeners on a delivery, that should happen on accept/reject.
Hello,
When using current version of Chinchilla and update the RabbitMQ client to version 3.5, the following exception is generated when invoking Depo.Connect.
Could not load type 'RabbitMQ.Client.Events.ConnectionShutdownEventHandler' from assembly 'RabbitMQ.Client, Version=3.5.0.0, Culture=neutral, PublicKeyToken=89e7d7c5feba84ce'.
Thanks,
Alan
AFAICS, the way that logging is currently implemented doesn't allow for creation of named loggers when using logging frameworks such as log4net or NLog.
Am I simply missing how this could be implemented with current ClassLogger
setup, or does the logging code need to be reworked?
Why don't exist .net 4.0 version?
I would like to know if there is a way to check if the connection to RabbitMQ server is still connected. I know in ModelFactory there is IsOpen property. However, is not available in IBus interface. Is there a way to check IsOpen or similar to and verify the connectivity is still up?
Thanks,
Alan
It would be nice to support .NET Standard as well as .NET Framework, so Chinchilla would run on .NET Core.
I've ran the Portability Advisor on the Chinchilla assembly, and the only issue was with DefaultMessageTypeFactory
, which does some stuff with reflection and app domains that is no longer supported in .NET Standard.
I would do this, but I've been away from Chinchilla for quite a while, and am not very familiar with the code base any more. And looking at DefaultMessageTypeFactory
it's rather difficult for me to decipher what it's doing :)
Hello. I need to use a custom request/reply topology builder. How can I inject this into the chinchilla bus instance? Or what do you think about approaches to implement this?
Hi Jonathan,
If I don't supply NumWorkers property a value, what is the default number of workers to handle messages in TaskDeliveryStrategy? Should I set NumWorkers and what is the ideal number?
Thank you for your help.
Alan
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.