public static void Received() { var factory = new ConnectionFactory() { HostName = "localhost" }; using var connection = factory.CreateConnection(); using var channel = connection.CreateModel(); channel.QueueDeclare(queue: Utility.QUEUE_NAME, durable: false, exclusive: false, autoDelete: false, arguments: null); var consumer = new EventingBasicConsumer(channel); consumer.Received += (model, ea) => { System.ReadOnlyMemory <byte> body = ea.Body; var message = Encoding.UTF8.GetString(body.ToArray()); WriteLine(" [x] Received {0}", message); }; channel.BasicConsume(queue: Utility.QUEUE_NAME, autoAck: true, consumer: consumer); WriteLine(" Press [enter] to exit."); ReadLine(); }
protected override async Task ExecuteAsync(CancellationToken stoppingToken) { while (!stoppingToken.IsCancellationRequested) { _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); var randomQueuename = _model.Model.QueueDeclare().QueueName; _model.Model.QueueBind(queue: randomQueuename, exchange: Utility.EXCHANGE_NAME, routingKey: ""); _logger.LogInformation("waiting for logs"); var consumer = new AsyncEventingBasicConsumer(_model.Model); consumer.Received += async(model, ea) => { System.ReadOnlyMemory <byte> body = ea.Body; var message = Encoding.UTF8.GetString(body.ToArray()); _logger.LogInformation("logs recevied: {message}", message); await Task.CompletedTask; }; _model.Model.BasicConsume(randomQueuename, true, consumer); await Task.Delay(5000, stoppingToken); } }
public override async System.Threading.Tasks.Task WriteAsync(System.ReadOnlyMemory <char> buffer, System.Threading.CancellationToken cancellationToken = default) { foreach (System.IO.TextWriter thisWriter in MWriters) { await thisWriter.WriteAsync(buffer, cancellationToken); } WrittenText?.Invoke(); }
private async Task Consumer_Received(object sender, BasicDeliverEventArgs e) { System.ReadOnlyMemory <byte> body = e.Body; var message = Encoding.UTF8.GetString(body.ToArray()); var eventName = e.RoutingKey; await ProcessEvent(message, eventName).ConfigureAwait(false); ((AsyncEventingBasicConsumer)sender).Model.BasicAck(deliveryTag: e.DeliveryTag, multiple: false); }
public async Task <string> Do(string cmd, bool expectReturns = true) { Console.WriteLine($"[{DateTime.Now}]{cmd}"); var buffer = new System.ReadOnlyMemory <byte>(Encoding.UTF8.GetBytes(cmd)); await _ws.SendAsync(buffer, WebSocketMessageType.Text, true, CancellationToken.None); var result = new ArraySegment <byte>(new byte[1024]); WebSocketReceiveResult resp = null; do { resp = await _ws.ReceiveAsync(result, CancellationToken.None); Task.Delay(1000); }while(expectReturns && resp.Count == 0); Console.WriteLine(resp.Count); var text = Encoding.UTF8.GetString(result.ToArray()); Console.WriteLine(text); return(text); }
public Rfc3161TimestampTokenInfo(System.Security.Cryptography.Oid policyId, System.Security.Cryptography.Oid hashAlgorithmId, System.ReadOnlyMemory <byte> messageHash, System.ReadOnlyMemory <byte> serialNumber, System.DateTimeOffset timestamp, long?accuracyInMicroseconds = default(long?), bool isOrdering = false, System.ReadOnlyMemory <byte>?nonce = default(System.ReadOnlyMemory <byte>?), System.ReadOnlyMemory <byte>?timestampAuthorityName = default(System.ReadOnlyMemory <byte>?), System.Security.Cryptography.X509Certificates.X509ExtensionCollection extensions = null) { }
public System.Security.Cryptography.Pkcs.Rfc3161TimestampToken ProcessResponse(System.ReadOnlyMemory <byte> responseBytes, out int bytesConsumed) { throw null; }
public static System.Security.Cryptography.Pkcs.Pkcs8PrivateKeyInfo DecryptAndDecode(System.ReadOnlySpan <char> password, System.ReadOnlyMemory <byte> source, out int bytesRead) { throw null; }
public Pkcs8PrivateKeyInfo(System.Security.Cryptography.Oid algorithmId, System.ReadOnlyMemory <byte>?algorithmParameters, System.ReadOnlyMemory <byte> privateKey, bool skipCopies = false) { }
public System.Security.Cryptography.Pkcs.Pkcs12SecretBag AddSecret(System.Security.Cryptography.Oid secretType, System.ReadOnlyMemory <byte> secretValue) { throw null; }
public static System.Security.Cryptography.Pkcs.Pkcs12Info Decode(System.ReadOnlyMemory <byte> encodedBytes, out int bytesConsumed, bool skipCopy = false) { throw null; }
public virtual System.Threading.Tasks.ValueTask <System.IO.Pipelines.FlushResult> WriteAsync(System.ReadOnlyMemory <byte> source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static bool TryDecode(System.ReadOnlyMemory <byte> encodedBytes, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Security.Cryptography.Pkcs.Rfc3161TimestampTokenInfo timestampTokenInfo, out int bytesConsumed) { throw null; }
public override void HandleBasicDeliver(string consumerTag, ulong deliveryTag, bool redelivered, string exchange, string routingKey, IBasicProperties properties, System.ReadOnlyMemory <byte> body) { var message = Encoding.UTF8.GetString(body.ToArray()); var responseMessage = string.Empty; if (message == "carbonara") { System.Console.WriteLine("Creating Carbonara"); responseMessage = "Creating Carbonara"; } else { System.Console.WriteLine("We are out of products"); responseMessage = "We are out of products"; } var replyMessageProperties = this.Model.CreateBasicProperties(); replyMessageProperties.CorrelationId = properties.CorrelationId; System.Console.WriteLine(properties.ReplyTo); System.Console.WriteLine(properties.CorrelationId); this.Model.BasicPublish("", properties.ReplyTo, replyMessageProperties, Encoding.UTF8.GetBytes(responseMessage)); }
public static bool TryDecode(System.ReadOnlyMemory <byte> encodedBytes, out System.Security.Cryptography.Pkcs.Rfc3161TimestampTokenInfo timestampTokenInfo, out int bytesConsumed) { throw null; }
public Pkcs12CertBag(System.Security.Cryptography.Oid certificateType, System.ReadOnlyMemory <byte> encodedCertificate) : base(default(string), default(System.ReadOnlyMemory <byte>), default(bool)) { }
public AsnReader(System.ReadOnlyMemory <byte> data, System.Formats.Asn1.AsnEncodingRules ruleSet, System.Formats.Asn1.AsnReaderOptions options = default(System.Formats.Asn1.AsnReaderOptions)) { }
protected Pkcs12SafeBag(string bagIdValue, System.ReadOnlyMemory <byte> encodedBagValue, bool skipCopy = false) { }
public bool TryReadPrimitiveBitString(out int unusedBitCount, out System.ReadOnlyMemory <byte> value, System.Formats.Asn1.Asn1Tag?expectedTag = default(System.Formats.Asn1.Asn1Tag?)) { throw null; }
public Pkcs12ShroudedKeyBag(System.ReadOnlyMemory <byte> encryptedPkcs8PrivateKey, bool skipCopy = false) : base(default(string), default(System.ReadOnlyMemory <byte>), default(bool)) { }
public bool TryReadPrimitiveCharacterStringBytes(System.Formats.Asn1.Asn1Tag expectedTag, out System.ReadOnlyMemory <byte> contents) { throw null; }
public static System.Security.Cryptography.Pkcs.Pkcs8PrivateKeyInfo Decode(System.ReadOnlyMemory <byte> source, out int bytesRead, bool skipCopy = false) { throw null; }
public bool TryReadPrimitiveOctetString(out System.ReadOnlyMemory <byte> contents, System.Formats.Asn1.Asn1Tag?expectedTag = default(System.Formats.Asn1.Asn1Tag?)) { throw null; }
public static System.Text.Json.JsonDocument Parse(System.ReadOnlyMemory <char> json, System.Text.Json.JsonDocumentOptions options = default(System.Text.Json.JsonDocumentOptions)) { throw null; }
public static System.Security.Cryptography.Pkcs.Rfc3161TimestampRequest CreateFromSignerInfo(System.Security.Cryptography.Pkcs.SignerInfo signerInfo, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.Oid requestedPolicyId = null, System.ReadOnlyMemory <byte>?nonce = default(System.ReadOnlyMemory <byte>?), bool requestSignerCertificates = false, System.Security.Cryptography.X509Certificates.X509ExtensionCollection extensions = null) { throw null; }