You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my Minio wrapper class I am using a function to add callbacks for notifications as follows:
publicvoidAddObjectEventListener(stringname,Func<MinioNotification,Task>callback,CancellationTokenct){
_logger.LogDebug("Listening for Object creation: {name}", name);varevents=newList<EventType>{ EventType.ObjectCreatedAll };ListenBucketNotificationsArgsargs=new ListenBucketNotificationsArgs().WithBucket(_minioConfig.Bucket).WithEvents(events).WithPrefix(name);IObservable<MinioNotificationRaw>observable= _minio.ListenBucketNotificationsAsync(args, ct);IDisposablesubscription= observable.Subscribe(notification =>{ callback(JsonSerializer.Deserialize<MinioNotification>(notification.Json)!);},ex => _logger.LogError("Minio Error while listening to bucket event: {ex}", ex),()=> _logger.LogDebug("Stopped listening for bucket notifications"));}
The callback function then might looks something like this:
privateasync Task CompleteFileUpload(MinioNotificationnotification){if(notification.Records isnull){
logger.LogWarning("S3 notification did not contain any records!");return;}foreach(var record in notification.Records){if(string.IsNullOrWhiteSpace(record?.S3?.ObjectMeta?.Key)){
logger.LogWarning("Unable to exctract object data from notification record!");return;}stringsecureObjectName= record.S3.ObjectMeta.Key;(CancellationTokenSource cts,int fileID)= _fileUploadEventInfos[secureObjectName];varuploadedTime= DateTime.UtcNow;await fileAccess.UpdateUploadStatus(fileID, UploadState.Ready, uploadedTime);
cts.Cancel();}}
Long story short, due to the int type for the object size in Minio/DataModel/Notification/ObjectMeta.cs serialization fails for bigger files. For the moment I fixed it on my side by using the raw json string directly and parse the needed information manually, but I though I'd report here, since it should be relatively easy to change this to long.
The text was updated successfully, but these errors were encountered:
In my Minio wrapper class I am using a function to add callbacks for notifications as follows:
The callback function then might looks something like this:
Long story short, due to the
int
type for the object size inMinio/DataModel/Notification/ObjectMeta.cs
serialization fails for bigger files. For the moment I fixed it on my side by using the raw json string directly and parse the needed information manually, but I though I'd report here, since it should be relatively easy to change this tolong
.The text was updated successfully, but these errors were encountered: