I'm attempting to use the new delayed delivery functionality from NMS.
The schedulerSupport attribute has been set in the config file, and I'm using the following code to attempt to delay delivery of a message until the date/time chosen by the user is reached.
The code (which does not seem to be working currently) is as follows:
var timeDelay = dateTimePicker.Value.Subtract(DateTime.Now).TotalMilliseconds;
var message = topicPublisher.CreateTextMessage();
message.Properties["AMQ_SCHEDULED_DELAY"] = timeDelay;
message.Text = CM.ToXMLString();
topicPublisher.Send(message);
Can you point out what might be incorrect within this example?
Many thanks!
I don't see anything obvious from the code provided.
You could try turning up the logging in the broker to see if the scheduler receives the message and that the values are correct, that would also confirm that you have indeed enabled scheduler support. You could also try creating a small java program that does something similar to determine if the NMS client is behaving correctly.
I assume you have a consumer running and its connection object has been started?
Regards
Tim.
www.fusesource.com
Thanks for your help with this Tim. I have found the cause of the issue. Slightly delayed response on my part - I had to concentrate on other areas of work, but I have today managed to come back to this.
The issue is the C# ".TotalMilliseconds" function - this returns a fractional total.partial milliseconds value, which it is apparent that ActiveMQ is not fond of.
Now I'm converting this millisecond value to an integer, the delayed messaging is working as required.
Log Excerpt Below:
2011-03-07 10:14:44,186 | DEBUG | quasar adding destination: topic://REDACTED | org.apache.activemq.broker.region.AbstractRegion | ActiveMQ Transport: tcp:///REDACTED:50161
2011-03-07 10:14:44,576 | DEBUG | Error occured while processing async command: ActiveMQTextMessage {commandId = 4, responseRequired = false, messageId = ID:HL003323-50159-634350896828327757-0:0:1:1:1, originalDestination = null, originalTransactionId = null, producerId = ID:HL003323-50159-634350896828327757-0:0:1:1, destination = topic://REDACTED, transactionId = null, expiration = 0, timestamp = 1299492884437, arrival = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null, replyTo = null, persistent = false, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = org.apache.activemq.util.ByteSequence#1ae0436, dataStructure = null, redeliveryCounter = 0, size = 0, properties = {targetModule=HL.Services.Blackbird.OrderManager, AMQ_SCHEDULED_DELAY=53564.4233}, readOnlyProperties = false, readOnlyBody = false, droppable = false, text = <?xml version="1.0" encoding="utf-16"?>
<Com...mandMessage>}, exception: java.lang.NullPointerException | org.apache.activemq.broker.TransportConnection.Service | ActiveMQ Transport: tcp:///REDACTED:50161
java.lang.NullPointerException
at org.apache.activemq.broker.scheduler.SchedulerBroker.send(SchedulerBroker.java:179)
at org.apache.activemq.broker.BrokerFilter.send(BrokerFilter.java:129)
at org.apache.activemq.broker.CompositeDestinationBroker.send(CompositeDestinationBroker.java:96)
at org.apache.activemq.broker.TransactionBroker.send(TransactionBroker.java:227)
at org.apache.activemq.broker.BrokerFilter.send(BrokerFilter.java:129)
at org.apache.activemq.broker.BrokerFilter.send(BrokerFilter.java:129)
at org.apache.activemq.security.AuthorizationBroker.send(AuthorizationBroker.java:192)
at org.apache.activemq.broker.MutableBrokerFilter.send(MutableBrokerFilter.java:135)
at org.apache.activemq.broker.TransportConnection.processMessage(TransportConnection.java:462)
at org.apache.activemq.command.ActiveMQMessage.visit(ActiveMQMessage.java:677)
at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:311)
at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:185)
at org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:69)
at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:113)
at org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMonitor.java:228)
at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83)
at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:220)
at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:202)
at java.lang.Thread.run(Thread.java:595)
2011-03-07 10:14:44,577 | WARN | Async error occurred: java.lang.NullPointerException | org.apache.activemq.broker.TransportConnection.Service | ActiveMQ Transport: tcp:///REDACTED:50161
java.lang.NullPointerException
at org.apache.activemq.broker.scheduler.SchedulerBroker.send(SchedulerBroker.java:179)
at org.apache.activemq.broker.BrokerFilter.send(BrokerFilter.java:129)
at org.apache.activemq.broker.CompositeDestinationBroker.send(CompositeDestinationBroker.java:96)
at org.apache.activemq.broker.TransactionBroker.send(TransactionBroker.java:227)
at org.apache.activemq.broker.BrokerFilter.send(BrokerFilter.java:129)
at org.apache.activemq.broker.BrokerFilter.send(BrokerFilter.java:129)
at org.apache.activemq.security.AuthorizationBroker.send(AuthorizationBroker.java:192)
at org.apache.activemq.broker.MutableBrokerFilter.send(MutableBrokerFilter.java:135)
at org.apache.activemq.broker.TransportConnection.processMessage(TransportConnection.java:462)
at org.apache.activemq.command.ActiveMQMessage.visit(ActiveMQMessage.java:677)
at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:311)
at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:185)
at org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:69)
at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:113)
at org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMonitor.java:228)
at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83)
at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:220)
at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:202)
at java.lang.Thread.run(Thread.java:595)
Related
Have a pretty much working environment to use for tracing, OpenTelemetry against Jaeger Tracing.
I sort of read that Batch for process is the preferred way then Simple. How ever with in .Net Framework 4.8 Batch dose not seem to give any results being logged.
I did a capture of packet data with Wireshark. Nothing happens when running in Batch.
Is there something with this configuration that is missing to have this as ExportProcessorType.Batch instead of ExportProcessorType.Simple?
public TracerProvider GetTracerProvider(string host, int port)
{
BackendServiceResource = ResourceBuilder.CreateDefault()
.AddService(Process.GetCurrentProcess().ProcessName)
.AddAttributes(new[]
{
new KeyValuePair<string, object>("MachineName", Environment.MachineName),
new KeyValuePair<string, object>("UserName", Environment.UserName),
});
return Sdk.CreateTracerProviderBuilder()
.SetResourceBuilder(BackendServiceResource)
.SetSampler(new AlwaysOnSampler())
.SetErrorStatusOnException(true)
.AddSource(ActivitySource.Name)
.AddConsoleExporter()
.AddJaegerExporter(jeager =>
{
jeager.AgentHost = host;
jeager.AgentPort = port;
jeager.MaxPayloadSizeInBytes = 4096;
jeager.ExportProcessorType = ExportProcessorType.Simple;
jeager.BatchExportProcessorOptions = new BatchExportProcessorOptions<Activity>()
{
MaxQueueSize = 2048,
ScheduledDelayMilliseconds = 5000,
ExporterTimeoutMilliseconds = 30000,
MaxExportBatchSize = 512,
};
})
.Build();
}
Thought I post a solution for this sort of issue.
The reason for these problems is because in some cases as application can close down before the process is fully completed. A solution for this is using and making sure that all gets completed before all is valid for closure.
You can read more about it more here https://github.com/open-telemetry/opentelemetry-dotnet/issues/2758
On the Microsoft website to download a bluetooth communication demo,
Search to a bluetooth device can be successful, but the connection equipment failure. (picture 1 and picture 2)
In picture 1, the bluetooth devices have searched out, then I skip step 2, directly to step 3, the back would have failed.(Picture 2)
Then I found methods BluetoothLEDevice. FromIdAsync always returns null.
Also Microsoft's official website of the API documentation does not give the reason of the return value is null.(Picture 3)
In this case the address:
https://github.com/Microsoft/Windows-universal-samples
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Warm prompt: (case of debugging environment)
System: win10 10.0.14393
IDE: vs2015
bluetooth devices: interface 4.0 (Texas Instruments)
System Settings: in win10 setting adjustment model for developers
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
I summarize the possible reasons:
① Bluetooth is not paired with the PC, so the device can not find the bluetooth service, I opened the device manager, found that the device did not find the service (Picture 4), but before doing Andrews Bluetooth development does not paired.
(Picture 4)
② Microsoft bluetooth communication API has a Bug
Search on the Internet three similar posts:
Post 1:BluetoothLEDevice.FromIdAsync returning null
(Because the reputation is not enough so only a link)
Supplement:
In the case, I skip step 2 pairs directly responsible for the equipment connection, because I don't know PIN. Then I'd like to find a PIN bycrack,
but this step is encapsulated in Microsoft's API, can't be a secondary operation.
Bluetooth 4.0 most of the automatic matching function, so Android phone can be directly connected do not need to pair.
So I guess Microsoft is not the method does not support automatic matching function.
(Finally, because of the prestige of my pictures can not upload.)
Base this official explanation, you
have to pair either through the Settings page or using the Windows.Devices.Enumeration APIs in order access these devices.
In the case, I skip step 2 pairs directly responsible for the
equipment connection, because I don't know PIN. Then I'd like to find
a PIN bycrack
Have you tried "0000" for the PIN?
Update:
Or, you can try use DeviceInformation.Pairing.Custom and set its pair type to ConfirmOnly and no encryption. Note, this will only work if the remote device does not require encryption or authentication to function. You can reference Scenario9_CustomPairDevice of the official sample DeviceEnumerationAndPairing. It will look like this:
I can create a pool with an autoscale formula fine. The code for this is as follows.
var pool = client.PoolOperations.CreatePool(poolName, vmsize, new CloudServiceConfiguration(osFamily, osVersion));
pool.TaskSchedulingPolicy = new TaskSchedulingPolicy(ComputeNodeFillType.Pack);
pool.AutoScaleFormula = autoscaleFormula;
pool.AutoScaleEnabled = true;
pool.AutoScaleEvaluationInterval = new TimeSpan(0, 0, 5, 0);
pool.Commit();
However if once the pool exists, I try and update the AutoScale formula, I get an error. The error is
{"The property AutoScaleFormula cannot be modified while the object is
in the Bound state."}
The code is
var client = BatchClient.Open(GetCloudSharedKeyCredentials(primary));
var pool = client.PoolOperations.GetPool(poolName);
pool.AutoScaleFormula = formula;
pool.AutoScaleEnabled = true;
pool.AutoScaleEvaluationInterval = new TimeSpan(0, 0, 5, 0);
pool.Commit();
This used to work before I updated to the latest version of the Azure Batch library. Has anyone got any experience of Azure Batch and can advise why I'm getting this error?
You can use the PoolOperations.EnableAutoScale method directly.
For your example, you could use the following:
var client = BatchClient.Open(GetCloudSharedKeyCredentials(primary));
client.Pooloperations.EnableAutoScale(poolName, formula, TimeSpan.FromMinutes(5));
If I create my Device and my SwapChain like this:
SwapChain _swapChain;
Device _device;
// SwapChain description
var desc = new SwapChainDescription()
{
BufferCount = 1,
ModeDescription = new ModeDescription(500, 300, new Rational(60, 1), Format.R8G8B8A8_UNorm),
IsWindowed = true,
OutputHandle = _windowHandle,
SampleDescription = new SampleDescription(1, 0),
Usage = Usage.RenderTargetOutput
};
Device.CreateWithSwapChain(DriverType.Hardware, DeviceCreationFlags.Debug,
desc, out _device, out _swapChain);
I get the expected debugging text:
Now if I create my Device and my SwapChain like this:
Factory _factory = new Factory();
Adapter adapter = _factory.GetAdapter(0);
SwapChain _swapChain;
Device _device = new Device(adapter, DeviceCreationFlags.Debug);
// SwapChain description
var desc = new SwapChainDescription()
{
BufferCount = 1,
ModeDescription = new ModeDescription(500, 300, new Rational(60, 1), Format.R8G8B8A8_UNorm),
IsWindowed = true,
OutputHandle = _windowHandle,
SampleDescription = new SampleDescription(1, 0),
Usage = Usage.RenderTargetOutput
};
_swapChain = new SwapChain(_factory, _device, desc);
I don't get the expected debugging text:
In addition to not getting the expected debugging text, I get a load of new messages in my output:
First-chance exception at 0x7631C42D in Tester.exe: Microsoft C++ exception: _com_error at memory location 0x064EEC28.
First-chance exception at 0x7631C42D in Tester.exe: Microsoft C++ exception: _com_error at memory location 0x064EED6C.
First-chance exception at 0x7631C42D in Tester.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
D3D11 ERROR: ID3D11Device::OpenSharedResource: Returning E_INVALIDARG, meaning invalid parameters were passed. [ STATE_CREATION ERROR #381: DEVICE_OPEN_SHARED_RESOURCE_INVALIDARG_RETURN]
D3D11 WARNING: ID3D11DeviceContext::OMSetRenderTargets: Resource being set to OM RenderTarget slot 0 is inaccessible because of a previous call to ReleaseSync or GetDC. [ STATE_SETTING WARNING #9: DEVICE_OMSETRENDERTARGETS_HAZARD]
D3D11 WARNING: ID3D11DeviceContext::Draw: The Pixel Shader expects a Render Target View bound to slot 0, but none is bound. This is OK, as writes of an unbound Render Target View are discarded. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Render Target View here. [ EXECUTION WARNING #3146081: DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET]
D3D11 WARNING: ID3D11DeviceContext::OMSetRenderTargets: Resource being set to OM RenderTarget slot 0 is inaccessible because of a previous call to ReleaseSync or GetDC. [ STATE_SETTING WARNING #9: DEVICE_OMSETRENDERTARGETS_HAZARD]
Where the last message repeats itself every frame...
Why is this happening? What's the difference between the 2 creation methods? How can I use the second creation method properly?
PS: I want to use the second creation method because I need the device to determine anti-aliasing settings...
PPS: In case it's needed, here's the code that creates the RenderTargetView:
using (Texture2D backBuffer = _swapChain.GetBackBuffer<Texture2D>(0))
{
_renderTargetView = new RenderTargetView(_device, backBuffer);
}
_context = _device.ImmediateContext;
_context.OutputMerger.SetRenderTargets(_renderTargetView);
_context.Rasterizer.SetViewport(0, 0, 500, 300);
Using the second method of Device creating, replacing
Device _device = new Device(adapter, DeviceCreationFlags.Debug);
with
Device _device = new Device(DriverType.Hardware, DeviceCreationFlags.Debug);
makes the debug text appear again. It also seems to remove the warning messages and the first-chance exceptions
I must say this in an extremely subtle difference, which I only found through comparing the 2 Graphics Event Lists...
I am trying to write 2 methods to test whether the sent message in one queue is received in another queue.
Send method - Sends message, for example - "Message 123" - to export queue with unique correlation id.
Get method
This queue will have many messages, however i want to get only the message that I sent from above based on my correlation ids.
Code to check message based on correlation id
properties = new Hashtable();
properties.Add(MQC.CONNECTION_NAME_PROPERTY, "connection name");
properties.Add(MQC.TRANSPORT_PROPERTY, "transport type");
properties.Add(MQC.CHANNEL_PROPERTY, "channel name");
properties.Add(MQC.CONNECT_OPTIONS_PROPERTY, MQC.MQCNO_HANDLE_SHARE_BLOCK);
mqGetMsgOpts = new MQGetMessageOptions();
mqGetMsgOpts.Options = MQC.MQGMO_BROWSE_FIRST | MQC.MQGMO_WAIT | MQC.MQOO_INQUIRE;
mqGetMsgOpts.MatchOptions = MQC.MQMO_MATCH_CORREL_ID;
mqGetMsgOpts.WaitInterval = 3000; //3 secs wait time
The issue am facing is when i read messages, i get all the messages from the import queue.
How do i get only the messages that i sent and validate that the message that is received in the export queue is mine?
Theoretically, something like this
message.correlationid from import queue matches message.correaltionid in the export queue.
Your snippet does not show setting correlId when reading messages. I have this sample code that gets only the message matching given correlId.
Like earlier, your snippet still has MQC.MQOO_INQUIRE for MQGMO. MQOOstands for Open Options whereas MQGMO stands for Get message options
try
{
importQ = qm.AccessQueue("Q2", MQC.MQOO_INPUT_SHARED | MQC.MQOO_OUTPUT | MQC.MQOO_FAIL_IF_QUIESCING);
// Put one message. MQ generates correlid
MQMessage mqPutMsg = new MQMessage();
mqPutMsg.WriteString("This is the first message with no app specified correl id");
importQ.Put(mqPutMsg);
// Put another messages but with application specified correlation id
mqPutMsg = new MQMessage();
mqPutMsg.WriteString("This is the first message with application specified correl id");
mqPutMsg.CorrelationId = System.Text.Encoding.UTF8.GetBytes(strCorrelId);
MQPutMessageOptions mqpmo = new MQPutMessageOptions();
importQ.Put(mqPutMsg,mqpmo);
mqPutMsg = new MQMessage();
// Put another message with MQ generating correlation id
mqPutMsg.WriteString("This is the second message with no app specified correl id");
importQ.Put(mqPutMsg);
// Get only the message that matches the correl id
MQMessage respMsg = new MQMessage();
respMsg.CorrelationId = System.Text.Encoding.UTF8.GetBytes(strCorrelId);
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.WaitInterval = 3000;
gmo.Options = MQC.MQGMO_WAIT;
gmo.MatchOptions = MQC.MQMO_MATCH_CORREL_ID;
importQ.Get(respMsg, gmo);
Console.WriteLine(respMsg.ReadString(respMsg.MessageLength));
}