gungod2000 commented on issue #208:
URL:
https://github.com/apache/pulsar-dotpulsar/issues/208#issuecomment-2012021907
It will be happen IndexOutOfRangeException .
thanks.
--------sample code-----
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private static List<IConsumer<string>> ConsumerPool = new
List<IConsumer<string>>();
private void Form1_Load(object sender, EventArgs e)
{
// add new consumer into pool
ConsumerPool.Add(new consumer()...);
}
private void button1_Click(object sender, EventArgs e)
{
//start some tasks to receive message
for (int i = 0; i < 10; i++)
{
Task.Factory.StartNew(() =>
{
//if add lock in here ,it will be fine ,but too slowly.
//get random consumer from pool
var consumer = ConsumerPool.GetSingleConsumer();
//receive message
var mesage = consumer.receive();
});
}
}
}
}
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]