i try to use from the code example this line
.Set(delegate(SubmitSm sm) { sm.Sequence = _client.SequenceGenerator.NextSequenceNumber();})
the error is
Severity Code Description Project File Line Suppression State
Error CS1061 'SubmitSm' does not contain a definition for 'Sequence' and no accessible extension method 'Sequence' accepting a first argument of type 'SubmitSm' could be found (are you missing a using directive or an assembly reference?) SmppClientDemo C:\C#\Inetlab.SMPP\Samples\CS\SmppClientDemo\SmppClientDemo.cs 485 Active
i tested it and the sequence looks when sending.
where i get the DeliverSm i see like the sequence i sent was ignored(?)
or should i look some where else in the response?
ee in image: https://pasteboard.co/IkKogh1.png
in the examples i saw i thought i can match by using the Sequence from the SubmitSm and DeliverSm
by setting them on my own (i want to have some id that i can match when i get the DeliverSm, since DeliverSm is incoming very fast
before i finish to parse the bulk of 100 or more sms that i send at once)
1. i do submitsm of 100 messages in 1 list for faster sending
2. since i do#1, some of the DelieverSm recievd faster then i finish to parse the messageid
public static async Task<IEnumerable<DeliverSm>> SendBatchAndWaitForDelivery(this SmppClient client,
IEnumerable<SubmitSm> list)
{
ConcurrentDictionary<string, TaskCompletionSource<DeliverSm>> deliveryTasks =
new ConcurrentDictionary<string, TaskCompletionSource<DeliverSm>>();
var onDeliver = new DeliverSmEventHandler((sender, data) =>
{
if (data.Receipt != null)
{
TaskCompletionSource<DeliverSm> task;
if (deliveryTasks.TryRemove(data.Receipt.MessageId, out task))
{
task.SetResult(data);
}
}
});
client.evDeliverSm += onDeliver;
List<Task> tasks = new List<Task>();
foreach (SubmitSm sm in list)
{
tasks.Add(client.Submit(sm).ContinueWith(t =>
{
TaskCompletionSource<DeliverSm> tcs = new TaskCompletionSource<DeliverSm>();
if (deliveryTasks.TryAdd(t.Result.MessageId, tcs))
{
return tcs.Task;
}
return Task.CompletedTask;
}));
}
await Task.WhenAll(tasks);
client.evDeliverSm -= onDeliver;
deliveryTasks.Clear();
return tasks.OfType<Task<DeliverSm>>().Select(x => x.Result);
}
You need some kind of process manager for submitted message that starts some work after receiving both SubmitSmResp and corresponding DeliverSm receipt.
in this approche you submit not 1 block of 100 but rather each message in a task, and this is much slower (i tested it, this is why i moved to the submitting of a list https://docs.inetlab.com/smpp/v2/articl ... s-possible