I'm trying to use a C# tlb as a reference then use that code in VBA. The VBA code looks like this:
Sub startConsumer()
Dim Consumer As Consumer.netConsumer
Set Consumer = New Consumer.netConsumer
MsgBox (Consumer.consume())
End Sub
The original C# code is like this:
namespace netConsumer
{
public class netConsumer
{
public static string message;
public static KafkaOptions options = new KafkaOptions(new Uri("http://rqdsn0c.bnymellon.net:9092"), new Uri("http://rqdsn0c.bnymellon.net:9092"), new Uri("http://rqdsn0c.bnymellon.net:9092"))
{
Log = new ConsoleLog()
};
public static BrokerRouter router = new BrokerRouter(options);
public static string consume()
{
Task.Factory.StartNew(() =>
{
var consumer = new Consumer(new ConsumerOptions("TestHarness3", router));
foreach (var data in consumer.Consume())
{
Console.WriteLine("Response: P{0},O{1} : {2}", data.Meta.PartitionId, data.Meta.Offset, data.Value);
var utf8 = Encoding.UTF8;
message += utf8.GetString(data.Value, 0, data.Value.Length);
ExcelWorksheet.writeToExcel(message);
}
});
return message;
}
}
}
Earlier it was working but now I'm getting Runtime error 438. Object doesn't support this property or method. I checked other answers and couldn't get a answer to my problem.